lightning icon indicating copy to clipboard operation
lightning copied to clipboard

xpay: Allow "includefees" option to deduct fees from total.

Open rustyrussell opened this issue 6 months ago • 2 comments

This is actually really tricky to implement, but useful for the case of "I want to spend all my funds". Note that this is more specific than allowing "all" as them amount parameter to xpay:

  • You may want to use it (with layers) to drain a specific channel.
  • If you're using accounts (I'm writing such a plugin) "all my funds" may not be "all the funds on the node" but some subset.

It's particularly hard with bolt12, since you have to request the invoice with a specific amount (though, you can overpay!) and you don't know the route yet!

rustyrussell avatar Jun 13 '25 02:06 rustyrussell

I don't think it is very difficult to implement in askrene.

The problems arise at the protocol level, I am guessing. Because the recipient doesn't know how much would he get. This means also trouble for MPP...

Unless the recipient himself computes the routes.

Lagrang3 avatar Jun 13 '25 16:06 Lagrang3

I think you end up approximating (assume max paid as fees), then increasing each payment slightly, then if all else fails, spending the last few sats on extra fees?

rustyrussell avatar Jun 26 '25 04:06 rustyrussell