ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.82k stars 895 forks source link

renepay: fees seems to be off #7055

Open Lagrang3 opened 7 months ago

Lagrang3 commented 7 months ago

I tried a payment (see the command line output below), the notes suggest that the total fees will amount to 600msat, but the difference between the amount sent and receive is actually 121378msat. Notice also that the flow amount 60009778msat does not correspond to the reported amount_sent_msat.

$ cln renepay lnbc...
# we have computed a set of 1 flows with probability 0.982, fees 598msat and delay 446
#   Flow 1: amount=60009778msat prob=0.982 fees=600msat delay=224 path=-826839x1256x0/0(min=max=6654910632msat)->-809546x2028x1/1->-800968x722x1/0->
#   Flow 1: Success
{
   "payment_preimage": "...",
   "payment_hash": "ff8c13f5a126e17fd90fdba5b58c91195966e6bedb15f85297159f361303835f",
   "created_at": 1707412130.071523515,
   "parts": 1,
   "amount_msat": 59889000,
   "amount_sent_msat": 60010378,
   "status": "complete",
   "destination": "03d607f3e69fd032524a867b288216bfab263b6eaee4e07783799a6fe69bb84fac"
}
Lagrang3 commented 7 months ago

So ... the flow amount shown on screen is actually the delivery amount + shadow fees. In this case shadow fees are 120778msat according to renepaystatus logs. In fact 59889000 + 120778 = 60009778. Then the actual fees to pay for that are 600msat, in fact 600 + 60009778 = 60010378. Hence, there is nothing wrong with the numbers, but the message I guess should inform that shadow fees are being used. Maybe:

#   Flow 1: amount (+shadow fee)=60009778msat prob=0.982 fees=600msat  ...