2
I am testing my own routing implementation and for some weird reason a handful of channels reject my payment stating InsufficientFee.
The scenario is A -c1-> B -c2-> C whereby Node A is sending a payment to C via B where the channels used are denoted as c1 and c2.
For c1 the node fee policies are
"node1_policy": {
"time_lock_delta": 40,
"min_htlc": "1",
"fee_base_msat": "1000",
"fee_rate_milli_msat": "1",
"max_htlc_msat": "16777215000",
},
"node2_policy": {
"time_lock_delta": 144,
"min_htlc": "1000",
"fee_base_msat": "1000",
"fee_rate_milli_msat": "100",
"max_htlc_msat": "16777215000",
},
For c2 the node fee policies are
"node1_policy": null,
"node2_policy": {
"time_lock_delta": 144,
"min_htlc": "1000",
"fee_base_msat": "10000",
"fee_rate_milli_msat": "100",
"max_htlc_msat": "10000000000",
}
For an amount of 4999000 mSat queryroutes uses this route and calculates the fees as
{'amt_to_forward': '4999',
'amt_to_forward_msat': '4999000',
'chan_capacity': '16777215',
'chan_id': 'c1',
'fee': '10',
'fee_msat': '10499',},
{'amt_to_forward': '4999',
'amt_to_forward_msat': '4999000',
'chan_capacity': '10000000',
'chan_id': 'c2',
'fee': '0',
'fee_msat': '0',}
'total_amt': '5009',
'total_amt_msat': '5009499',
'total_fees': '10',
'total_fees_msat': '10499',}
Could someone please explain in step-by-step detail how the lnd client gets to this value?
Thank you for answering, However it seems that the lnd client rounds payments, if I enter
4999999its rounded to4999000surely it should not do this? Edit:queryroutestakes Satoshis, not mSat, so the rounding will always occur regardless. – Oonah – 2019-11-13T14:17:37.420One issue I found now, that i cannot seem to explain is, in one case
n1_policyis'fee_base_msat': '489', 'fee_rate_milli_msat': '1000',whilstn2_policyis'fee_base_msat': '1000', 'fee_rate_milli_msat': '1',. In this casen1received the payment, why wouldlndchoosen1policy instead ofn2? – Oonah – 2019-11-13T16:11:30.523