-
Notifications
You must be signed in to change notification settings - Fork 419
Support multi-hop blinded paths for ReleaseHeldHtlc
#4066
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
base: main
Are you sure you want to change the base?
Support multi-hop blinded paths for ReleaseHeldHtlc
#4066
Conversation
I've assigned @tankyleo as a reviewer! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4066 +/- ##
==========================================
- Coverage 88.70% 88.53% -0.18%
==========================================
Files 176 175 -1
Lines 132859 132779 -80
Branches 132859 132779 -80
==========================================
- Hits 117854 117555 -299
- Misses 12309 12621 +312
+ Partials 2696 2603 -93
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
010b2b9
to
4cc7ff7
Compare
I'd hold off on this because it doesn't seem a strict requirement for initial deployment. |
Needs rebase now 🎉 |
4cc7ff7
to
0721c9e
Compare
0721c9e
to
27f4930
Compare
In upcoming commits, we'll move to creating multi-hop blinded paths during the process of creating a revoke_and_ack message within the Channel struct. These paths will be included in said RAA to be used as reply paths for often-offline senders held_htlc_available messages. Because we hold the per-peer lock corresponding to the Channel while creating this RAA, we can't use our typical approach of calling ChannelManager::get_peers_for_blinded_path to create these blinded paths. The ::get_peers method takes each peer's lock in turn in order to check for usable channels/onion message feature support, and it's not permitted to hold multiple peer state locks at the same time due to the potential for deadlocks (see the debug_sync module). To avoid taking other peer state locks while holding a particular Channel's peer state lock, here we cache the set of peers in the OffersMessageFlow, which is the struct that ultimately creates the blinded paths for the RAA.
In the previous commit, we started caching the set of peers in the OffersMessageFlow that are used when creating blinded paths. Here we start using that cache and stop passing in the peers for every method.
We've been including blinded paths in our RAA messages for async payments purposes, but had to use 1-hop blinded paths because we can't acquire additional peer locks while holding a specific channel's peer lock during the RAA creation process. In the past few commits we started caching the set of peers in the OffersMessageFlow, so we can now generate multi-hop blinded paths during the RAA creation process without needing to acquire additional peer locks.
27f4930
to
bddbd9c
Compare
invoice_request.clone(), payment_id, nonce, | ||
self.get_peers_for_blinded_path() | ||
)?; | ||
self.flow.enqueue_invoice_request(invoice_request.clone(), payment_id, nonce,)?; |
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.
There's a syntax error in this line - the trailing comma before the closing parenthesis is invalid. The comma after nonce
should be removed to make this valid Rust syntax:
self.flow.enqueue_invoice_request(invoice_request.clone(), payment_id, nonce)?;
self.flow.enqueue_invoice_request(invoice_request.clone(), payment_id, nonce,)?; | |
self.flow.enqueue_invoice_request(invoice_request.clone(), payment_id, nonce)?; |
Spotted by Diamond
Is this helpful? React 👍 or 👎 to let us know.
In #4045, as part of supporting sending payments as an often-offline sender to an often-offline recipient, we began including blinded paths in the sender's LSP's RAA message for use as reply paths to the sender's
held_htlc_available
messages.Because we hold the per-peer lock corresponding to the Channel while creating this RAA, we can't use our typical approach of calling
ChannelManager::get_peers_for_blinded_path
to create these blinded paths. The::get_peers
method takes each peer's lock in turn in order to check for usable channels/onion message feature support, and it's not permitted to hold multiple peer state locks at the same time due to the potential for deadlocks (see thedebug_sync
module).To avoid taking other peer state locks while holding a particular
Channel
's peer state lock, here we cache the set of peers in theOffersMessageFlow
, which is the struct that ultimately creates the blinded paths for the RAA.For consistency, we also stop passing in peers to every other
OffersMessageFlow
method.Based on
#4045,#4046