lightning-box icon indicating copy to clipboard operation
lightning-box copied to clipboard

Attempt LNURL pay forwarding only if wallet supports it

Open lirre8 opened this issue 1 year ago • 2 comments

Currently, if the wallet receiving an LNURL pay request is online but doesn't support forwarding lightning-box will time out after 30 seconds, in which case the senders wallet most likely has timed out already causing the payment to fail. In other words, it is only possible to send LNURL pay requests to wallets that doesn't support forwarding if the wallet is offline.

What do you think about adding a field on user level whether that user supports forwarding or not? And then only attempt forwarding if they do.

lirre8 avatar Apr 16 '23 08:04 lirre8

Hi @lirre8, thank you for opening this issue. Indeed, the implementation is currently a bit sloppy. As a stop-gap fix, you can set the pubkey of the user to an empty string instead of the wallet pubkey. That way an attempt to forward the payment will never occur.

hsjoberg avatar Apr 18 '23 15:04 hsjoberg

Ah right, didn't realize the pubkey was only used for the forwarding. I made this a bit more complicated fix that I'm running now: https://github.com/lirre8/lightning-box/commit/953a4d92ae6788202a91ada29a592ac3cfaceffb Not sure if that's anything how you want it to work?

It does allow the user to have a pubkey though, which brings me to my next idea: Is there any scenario where a withdrawal from the box should be allowed to a different pubkey than the one saved on the user? Or would it be a good to check that the destination pubkey always matches the user's pubkey: https://github.com/hsjoberg/lightning-box/blob/0276614b73276d82844cd09e5c053d270c933369/src/api/withdraw.ts#L121

lirre8 avatar Apr 19 '23 09:04 lirre8