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?