-
Notifications
You must be signed in to change notification settings - Fork 266
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
Add support for option_payment_metadata
#2063
Conversation
a543803
to
498cd91
Compare
498cd91
to
a3bac32
Compare
So for interop testing, we can only do eclair -> lnd? |
Right now yes, as the description mentions including a |
Shall I get you a testnet invoice so that you can try to pay it? |
I'm not ready yet for compat tests, I should address my first three todos before that, I'll let you know when I'm ready. |
270ad26
to
1fa59e2
Compare
@joostjager this should now be ready for interop testing 🎉 |
e0263f4
to
92e0553
Compare
Tried, but running into this when opening a channel from lnd:
I thought this thing was solved? |
Looks like it's not! Are you sure you're running an up-to-date lnd? |
I also tried with vanilla Repro:
|
One finding is that |
Good catch, I need to add that! |
We now have this problem: lightning/bolts#912 (comment) |
Codecov Report
@@ Coverage Diff @@
## master #2063 +/- ##
==========================================
+ Coverage 87.58% 87.61% +0.03%
==========================================
Files 165 166 +1
Lines 12788 12929 +141
Branches 563 550 -13
==========================================
+ Hits 11200 11328 +128
- Misses 1588 1601 +13
|
Spec update to use tlv field 16. If you update this PR, I can do another attempt at interop. |
4cd438f
to
2174199
Compare
Done. |
The interop test passed. I received payment metadata from eclair:
|
Thanks for testing this Joost! |
Tested LND->Eclair interop, seems to work too
|
Thanks for the tests @joostjager! |
@thomash-acinq I put you as reviewer as this touches invoice stuff, so it may be loosely related to your work on offers (at least it may be useful for you to track this change). I'm interested in your feedback on this, it's ready to review as the spec PR has been merged recently and we've verified interop with lnd. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for missing this PR earlier. It would be nice some integration tests, especially on how it interacts with trampoline.
eclair-core/src/main/scala/fr/acinq/eclair/payment/PaymentRequest.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/payment/PaymentPacket.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/wire/protocol/PaymentOnion.scala
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LMostlyGTM, just a few nits or suggestions.
eclair-core/src/main/scala/fr/acinq/eclair/payment/receive/MultiPartHandler.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/wire/protocol/PaymentOnion.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/payment/receive/MultiPartHandler.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/wire/protocol/PaymentOnion.scala
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/payment/receive/MultiPartHandler.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/payment/PaymentPacket.scala
Outdated
Show resolved
Hide resolved
@@ -114,6 +115,8 @@ object PaymentReceived { | |||
|
|||
} | |||
|
|||
case class PaymentMetadataReceived(paymentHash: ByteVector32, paymentMetadata: ByteVector) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also add it to the PaymentReceived
defined above instead of creating a new event just for the metadata.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried, but it is much more invasive (in particular because we store PaymentReceived
in the DB)...and I'm not sure in the long run we will want it in PaymentReceived
(which happens after the payment has been accepted and fulfilled), but instead before we accept it, so I chose the simplest solution until we know more (but we can definitely change this later if it makes more sense in PaymentReceived
!).
Add support for
option_payment_metadata
as specified in lightning/bolts#912This feature lets recipients generate "light" invoices without storing them in the local DB until they are paid.
The trick is to simply put the important data (mainly
payment_secret
andtotal_amount
) in an encrypted blob inside the invoice, and verify its presence and integrity when receiving a payment that contains apayment_metadata
field (and insert it in the DB on-the-fly).This PR only implements support for the sender side, as recipients will only be able to leverage this features once all senders support it.
We do include a
payment_metadata
in all invoices we generate, which lets us know whether our payers support this feature: this is important data to have before we decide to make it mandatory and actually implement storage-less invoices.We also take this opportunity to have our first invoice-only feature to implement feature bit filtering, as required by the spec (
IN9
flags as specified in bolt 9): see the first commit of the PR.The commits are somewhat independent and can be reviewed separately.