-
Notifications
You must be signed in to change notification settings - Fork 267
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 initial support for async payment trampoline relay #2435
Conversation
Some Questions for my next set of changes to this PR:
I currently use invoice feature bits because an empty tlv seemed wrong. The sender will look for the
|
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.
Nice, you found your way around the right parts of the codebase, most of this looks correct!
When I change the AsyncPaymentTrigger message to be a non-spec LightningMessage that is routed to the NodeRelayer, should it be keyed off of the nodeRelayPacket.outerPayload.paymentSecret for the node relayer ?
I don't think we need to define a LightningMessage
for the AsyncPaymentTrigger
.
This won't be something we receive from the recipient peer when it comes back online.
It will just be an internal component that will send this internal message to the event stream.
Let me know what you think, I think the flow should be the following:
- we should add a singleton actor named something like
AsyncPaymentWatcher
- when the
NodeRelay
component goes to thewaitForTrigger
behavior, it should send aNotifyWhenPeerOnline(replyTo, remoteNodeId, paymentHash)
to theAsyncPaymentWatcher
- the job of the
AsyncPaymentWatcher
will be to check when the peer comes back online, and when the peer is back online, to sendAsyncPaymentTrigger/RelayAsyncPayment
to the correspondingreplyTo
actor
What I don't know yet is if this should be a new actor or if we should enrich an existing actor with that new responsibility.
eclair-core/src/main/scala/fr/acinq/eclair/payment/relay/NodeRelay.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/payment/relay/NodeRelay.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/payment/relay/NodeRelay.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/wire/protocol/PaymentOnion.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/wire/protocol/PaymentOnion.scala
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #2435 +/- ##
==========================================
+ Coverage 84.71% 84.86% +0.15%
==========================================
Files 199 198 -1
Lines 15748 15796 +48
Branches 656 680 +24
==========================================
+ Hits 13341 13406 +65
+ Misses 2407 2390 -17
|
eclair-core/src/main/scala/fr/acinq/eclair/payment/relay/Relayer.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/relay/NodeRelay.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/main/scala/fr/acinq/eclair/payment/relay/NodeRelay.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/payment/relay/NodeRelayerSpec.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/payment/relay/NodeRelayerSpec.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/payment/relay/NodeRelayerSpec.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/payment/relay/NodeRelayerSpec.scala
Outdated
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/payment/relay/NodeRelayerSpec.scala
Outdated
Show resolved
Hide resolved
also: - fail timeouts with TemporaryNodeFailure instead of PaymentTimeout - publish new WaitingToRelayPayment event
RE: @t-bast 's point earlier about the possibility of a channel closure if the receiver does not trigger the payment and the sender is not back online within An async payment sender should probably set the payment expiry well beyond their LSP's expected |
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.
LGTM, a last couple of nits and we should be good to go 🚀
eclair-core/src/main/scala/fr/acinq/eclair/payment/relay/NodeRelay.scala
Show resolved
Hide resolved
eclair-core/src/test/scala/fr/acinq/eclair/payment/relay/NodeRelayerSpec.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.
LGTM! Don't forget to use github's "squash and merge" option, this is good to go 👍
This is the first step in adding "async payments" as described in issue #2424 .