-
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
Check peer features before attempting wake-up #2979
base: master
Are you sure you want to change the base?
Conversation
Looks good, waiting for the rebase on #2978 |
9e98aa7
to
25d4cb6
Compare
Before relaying a trampoline payment, we check if the next node is one of our direct peers. If that's the case, we check their features to see if they support waking up through notifications, in which case we go through the wake-up flow. Note that we don't need this for channel relay, because: - if it is a Bolt 12 payment, the recipient will use a `wallet_node_id` to let us know that they support wake-up notifications - if it is a Bolt 11 payment, we use a custom `short_channel_id` for phoenix that also lets us know that they support wake-up notifications
25d4cb6
to
c193622
Compare
Rebased now that #2978 has been merged! |
case Some(walletNodeId) if nodeParams.peerWakeUpConfig.enabled => waitForPeerReady(upstream, walletNodeId, recipient, nextPayload, nextPacket_opt) | ||
case walletNodeId_opt => relay(upstream, recipient, walletNodeId_opt, None, nextPayload, nextPacket_opt) | ||
/** The next node may be a mobile wallet directly connected to us: in that case, we'll need to wake them up before relaying the payment. */ | ||
private def checkIfRecipientIsWallet(upstream: Upstream.Hot.Trampoline, recipient: Recipient, nextPayload: IntermediatePayload.NodeRelay, nextPacket_opt: Option[OnionRoutingPacket]): Behavior[Command] = { |
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.
It is currently not clear that checkIfRecipientIsWallet
is actually checking preconditions for auto-wake up. I would also rename waitForPeerReady
to attemptWakeUp
.
private def checkIfRecipientIsWallet(upstream: Upstream.Hot.Trampoline, recipient: Recipient, nextPayload: IntermediatePayload.NodeRelay, nextPacket_opt: Option[OnionRoutingPacket]): Behavior[Command] = { | |
private def attemptWakeUpIfRecipientIsWallet(upstream: Upstream.Hot.Trampoline, recipient: Recipient, nextPayload: IntermediatePayload.NodeRelay, nextPacket_opt: Option[OnionRoutingPacket]): Behavior[Command] = { |
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.
Renamed in a50678e
Before relaying a trampoline payment, we check if the next node is one of our direct peers. If that's the case, we check their features to see if they support waking up through notifications, in which case we go through the wake-up flow.
Note that we don't need this for channel relay, because:
wallet_node_id
to let us know that they support wake-up notificationsshort_channel_id
for phoenix that also lets us know that they support wake-up notifications