Closed cdecker closed 3 months ago
Thanks @cdecker for the anlysis. We have a function in the sdk onchain_payment_limits
which should return the max amount the user can swap out. we do that by composing the shortest path to the swapper and reverse comuting the fees so the amount the user sees is the channels balance minus the fees. Then we use send_pay
to send using this specific route.
If the user ignores this value and attempts to send all the balance then might fall into this.
Is it connected to any supsport case where I can return to the user and ask for some info? Perhaps relai?
I see, yes, in that case the behavior is correct, since the SDK accounts for fees. I misinterpreted the amounts matching as the situation at the recipient (sans fees) and not at the sender (with fees). So this is all good, I just got confused.
After analyzing a number of failed swaps we found that the
sendpay
command used to send the HTLC to the swap service does not leave any funds for fees, thus dooming the swap to fail.The following is a payment that @rnaar and I debugged earlier today:
Looking into the corresponding session we can see the following logs:
Notice that we are using a channel whose amount, rounded to
sat
, matches exactly the amount to be sent. This cannot work in routed payments as soon as we have a base fee >0.862sat or a PPM fee of >2.17 sat / Msat.Please either directly connect to the swap service, in which case a fee-less route is possible, or leave some satoshis for fees.