tecPATH_PARTIAL - 2 tx's. One succeeds. One does not. Why?

Technical questions about the Ripple API, the protocol, etc.

tecPATH_PARTIAL - 2 tx's. One succeeds. One does not. Why?

Postby loquitus » Sat Oct 04, 2014 11:43 am

Hello.

I have been trying to resolve this issue for several days now and still only have a partial vague understanding as to why it is happening, but most importantly, have not really been able to solve it.

When I submit my transactions (all of which result in currency conversion because the sendmax refers to one single currency and the actual destination currency is different from sendmax), I seem to get the following:

engine_result => tecPATH_PARTIAL
engine_result_code => 101
engine_result_message => "Path could not send full amount."

Any ideas? Interestingly, not all tx's fail that I compose and sign myself. If I am doing tx's between USD and MXN and even BTC, it seems to be mostly ok and I don't get the above error. But as soon as I try to deal with currencies like CAD, GBP, JPY, etc... the above error happens. My trustlines are all huge for all the gateways that I have support for on these currencies.

My understanding from reading the Ripple API documentation is paths are optional, in that converting X to Y will work without a path if there is a direct path from X to Y. But if there is no direct path, a path has to be specified, as the path does not include the start and end points, and therefore includes all intermediary points in non-direct payments.

Now here is the super interesting part. I tried to convert MXN to GBP. It failed. If you look at https://ripple.com/tools/info/#rfk8oKzP ... FHn3pFoMKE, you might find transaction with sequence #301 for ripple address rfk8oKzPbxQTRWZVPTmBKEfcFHn3pFoMKE. This one failed.

Transaction #302 (right after the failed one) succeeded. I issued the command to do #302 through the RippleTrade client. #301 was what I composed in my code. I have pasted below the JSON for these two. They are ALMOST identical. The only difference (apart from hashes) is the path. It appears the successful JSON has a path that is a bit simpler than the failing JSON.

I would be enormously grateful if someone could take a quick look at these and point out why one succeeded and one failed. I have tried to wrap my head around paths since that is the only thing left that is different. I think the losing path contains the winning path in the first array, although it has one extra "hop" at the start.

Thanks in advance.

The JSON for the failed tx (301) is:

tx : {
Account : "rfk8oKzPbxQTRWZVPTmBKEfcFHn3pFoMKE",
Amount : {
currency : "GBP",
issuer : "rfk8oKzPbxQTRWZVPTmBKEfcFHn3pFoMKE",
value : "0.2"
},
Destination : "rfk8oKzPbxQTRWZVPTmBKEfcFHn3pFoMKE",
Fee : "100",
Flags : 0,
LastLedgerSequence : 9189285,
Paths : [
[
{
account : "rG6FZ31hDHN1K5Dkbma3PSB5uVCuVVRzfn",
type : 1,
type_hex : "0000000000000001"
},
{
currency : "XRP",
type : 16,
type_hex : "0000000000000010"
},
{
currency : "GBP",
issuer : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
type : 48,
type_hex : "0000000000000030"
},
{
account : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
type : 1,
type_hex : "0000000000000001"
}
],
[
{
account : "rG6FZ31hDHN1K5Dkbma3PSB5uVCuVVRzfn",
type : 1,
type_hex : "0000000000000001"
},
{
currency : "USD",
issuer : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
type : 48,
type_hex : "0000000000000030"
},
{
account : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
type : 1,
type_hex : "0000000000000001"
},
{
currency : "GBP",
issuer : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
type : 48,
type_hex : "0000000000000030"
},
{
account : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
type : 1,
type_hex : "0000000000000001"
}
]
],
SendMax : {
currency : "MXN",
issuer : "rG6FZ31hDHN1K5Dkbma3PSB5uVCuVVRzfn",
value : "4.7686798344"
},
Sequence : 301,
SigningPubKey : "02F7BC2267B0ADD919159C9DBB702BA92E69D1F177AEB4EC4F08D807F603ED607A",
TransactionType : "Payment",
TxnSignature : "3045022100F558040BC21FC05A37CB74B6D906392573D1D2504145A810D1CC636F99CDE95D022058AD80646FC7C3124CFEA87C0ADF5716D1F40148A1C38CD8DB07D9055C84E081",
date : 465733980,
hash : "15ECF8FD878515158897942FD1435D8810C110AFBBB04974D2C3BBFC0EB378E0",
inLedger : 9189283,
ledger_index : 9189283
}

The JSON for the successful tx (302) is:

tx : {
Account : "rfk8oKzPbxQTRWZVPTmBKEfcFHn3pFoMKE",
Amount : {
currency : "GBP",
issuer : "rfk8oKzPbxQTRWZVPTmBKEfcFHn3pFoMKE",
value : "0.2"
},
Destination : "rfk8oKzPbxQTRWZVPTmBKEfcFHn3pFoMKE",
Fee : "28",
Flags : 0,
LastLedgerSequence : 9189313,
Memos : [ /* 1 items */ ],
Paths : [
[
{
currency : "XRP",
type : 16,
type_hex : "0000000000000010"
},
{
currency : "GBP",
issuer : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
type : 48,
type_hex : "0000000000000030"
},
{
account : "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
type : 1,
type_hex : "0000000000000001"
}
]
],
SendMax : {
currency : "MXN",
issuer : "rG6FZ31hDHN1K5Dkbma3PSB5uVCuVVRzfn",
value : "4.7451888"
},
Sequence : 302,
SigningPubKey : "02F7BC2267B0ADD919159C9DBB702BA92E69D1F177AEB4EC4F08D807F603ED607A",
TransactionType : "Payment",
TxnSignature : "3045022100BDCAC488545D2AA1EFA52630B2E72A6AFE9BAFF0D8430453EE6D29E0CFFE2607022054EE3053EB18F7FFB865F0D9D24E8932B783748B495B1A177E5E85103A6164F1",
date : 465734090,
hash : "909E801BA89FD3A1BD60BA385A91092669BA97209EC86D07074584A81B45318C",
inLedger : 9189305,
ledger_index : 9189305
}
Computer Scientist
User avatar
loquitus
 
Posts: 8
Joined: Tue Sep 30, 2014 9:40 pm

Re: tecPATH_PARTIAL - 2 tx's. One succeeds. One does not. Wh

Postby JoelKatz » Mon Oct 06, 2014 5:44 pm

The SendMax issuer should be the sending account.
User avatar
JoelKatz
Ripple
Ripple
 
Posts: 1859
Joined: Sun Dec 23, 2012 3:45 pm
Location: Oakland, CA

Re: tecPATH_PARTIAL - 2 tx's. One succeeds. One does not. Wh

Postby loquitus » Mon Oct 06, 2014 10:34 pm

Interesting. Thanks for the answer.

In an effort not to confuse this further, I noticed last night (before switching to using the sending account as the sendmax issuer) that Ripple was now coming back saying the fees were insufficient. This was with the same code and logic as before.

So how any idea how come the fee was no longer enough? Do the fees required change alot and is there some criteria to know what's enough? I had set the fee to 100 (XRP drops, I beleive?). That was supposedly enough, in that at least some of the tx's as mentioned before would work.

This morning, I changed the sendmax issuer to be the sending account. I also changed to using a fee of 10000 xrp drops from what was 100 before.

Guess what? Everything works now! I tried about 50+ different currency exchanges of various amounts and combinations and it all worked!

But this is puzzling... the following questions if you don't mind...

1. Why did the fee required change? Is there some way to know? It seems the server now requires me to set the fee in the tx to way more to not get the insufficient fees error.
2. If you notice, the tx json given originally in this post for the tx that was successful (from RippleTrade) did NOT have the sender account as the issuer in the SendMax. In fact, I think RippleTrade does not set the sender account to be the sendmax issuer. So why then do I have to do that here?

Thanks. This is all very interesting.
Computer Scientist
User avatar
loquitus
 
Posts: 8
Joined: Tue Sep 30, 2014 9:40 pm

Re: tecPATH_PARTIAL - 2 tx's. One succeeds. One does not. Wh

Postby bibbit » Tue Oct 07, 2014 5:58 am

loquitus wrote:So how any idea how come the fee was no longer enough? Do the fees required change alot and is there some criteria to know what's enough? I had set the fee to 100 (XRP drops, I beleive?). That was supposedly enough, in that at least some of the tx's as mentioned before would work.


The fee changes based on the load experienced by the system. See the wiki page on Transaction Fee for extensive details.

Pay special attention to the section on calculating the fee. The short summary is that you can make a call to server_state and then calculate the required fee based on the returned values:

Code: Select all
transaction_fee (in drops) = base_fee * load_factor / load_base


You can monitor the server_stream and ledger stream for updates.
raj7HbHuG4da8bm5eNA8dAD19t8Kj8G4NR
bibbit
 
Posts: 410
Joined: Wed Sep 04, 2013 10:18 am


Return to Developers

Who is online

Users browsing this forum: Bing [Bot] and 2 guests