Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't send payment secret when using keysend #2574

Merged
merged 1 commit into from
Jan 23, 2023

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Jan 19, 2023

Apparently lnd rejects keysend payments that contain a payment secret, instead of simply ignoring that field.

The blip doesn't mention this requirement:
https://github.com/lightning/blips/blob/master/blip-0003.md

But we don't have a strong reason to send it either, so let's remove that.

Waiting for @kiwiidb to confirm that this fixes the lnd compatibility issues.

Apparently lnd rejects keysend payments that contain a payment secret,
instead of simply ignoring that field.

The blip doesn't mention this requirement:
https://github.com/lightning/blips/blob/master/blip-0003.md

But we don't have a strong reason to send it either, so let's remove that.
@kiwiidb
Copy link

kiwiidb commented Jan 20, 2023

I've built and tested this branch on regtest and can confirm that sending keysend payments now works to both LND and CLN nodes.

@t-bast t-bast marked this pull request as ready for review January 20, 2023 09:18
@kiwiidb
Copy link

kiwiidb commented Jan 20, 2023

Keysend from LND -> Eclair works as well on this branch. However, CLN -> Eclair fails with WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS.

@t-bast
Copy link
Member Author

t-bast commented Jan 20, 2023

However, CLN -> Eclair fails with WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS.

That's surprising, can you share logs for that failure?

@kiwiidb
Copy link

kiwiidb commented Jan 20, 2023

Found them:

2023-01-20 09:32:05,984 WARN  f.a.e.p.r.PaymentHandler PAY 
h:9deb8d9b868a8a7e9ffd0aba03ab64892e538673072c7510490dc83fbae632aa -
received payment with expiry too small for amount=1000000 msat totalAmount=1000000 msat

This if for the CLN command:
lightning-cli --network regtest keysend 02ca4adae421945a328735519f6113e9c8d95979a9c573aba6bc26ca72af187564 1000000.
There is a direct channel between these 2 nodes.
EDIT: CLN version should be v22.11

@t-bast
Copy link
Member Author

t-bast commented Jan 20, 2023

Got it, this is somewhat independent of keysend. By default eclair uses very safe values for expiry deltas, but when using keysend we can't communicate that to the payer so they may use smaller values. This is generally an issue because accepting that payment creates a risk that if your peer force-closes, you won't be able to get the funds back in time...

You can change that default value in your eclair.conf, by setting for example (the default is 30 blocks):

eclair.channel.min-final-expiry-delta-blocks = 6

We could relax that for keysend, but this is a bit painful to do, I'd rather have senders behave well and send a bigger expiry delta here...I recommend checking what delta cln and lnd and set this eclair.conf value to the highest value possible that matches what senders do.

@t-bast t-bast merged commit d52e869 into master Jan 23, 2023
@t-bast t-bast deleted the keysend-no-payment-secret branch January 23, 2023 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants