-
Notifications
You must be signed in to change notification settings - Fork 384
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
Routing to blinded payment paths #2120
Routing to blinded payment paths #2120
Conversation
6841e43
to
6e6f76e
Compare
c0c4a84
to
d5c978c
Compare
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #2120 +/- ##
==========================================
+ Coverage 90.48% 91.30% +0.81%
==========================================
Files 104 106 +2
Lines 53920 63000 +9080
Branches 53920 63000 +9080
==========================================
+ Hits 48792 57525 +8733
- Misses 5128 5475 +347
☔ View full report in Codecov by Sentry. |
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.
We should definitely land at least the new serialization backwards-incompatible hints tlvs for the next release.
d5c978c
to
fb85bbd
Compare
fb85bbd
to
79e3442
Compare
ad8ccbf
to
559ec3b
Compare
if blinded_path.blinded_hops.len() == 0 { | ||
return Err(LightningError{err: "0-hop blinded path provided".to_owned(), action: ErrorAction::IgnoreError}); | ||
} else if &blinded_path.introduction_node_id == our_node_pubkey { | ||
log_info!(logger, "Got blinded path with ourselves as the introduction node, ignoring"); |
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.
Should this get some kind of TODO? Or should we just always use this path directly?
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.
We can't use these paths atm because get_route
doesn't have the ability to "advance" the blinded path to the next hop (and we can't pathfind to ourselves, ofc). Previously discussed here: #2146 (comment)
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.
Ah, I misunderstood that comment, so I think there's another way to handle this - let get_route
return early with a 0-hop unblinded path portion and the blinded tail as-is. Then the paying code would handle it by detecting this case and doing the advancing itself.
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.
Hmm, I don't see how that would work if the max_htlc
of the 1 blinded hint isn't sufficient for the entire payment?
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.
Mmm right, I suppose we could pre-select it as a path and then run the router to select more paths if needed? That seems like it would work pretty easy.
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.
Yeah that sounds good! We might want to have another prefactor, though, because there's still assumptions that path.hops.len() > 0
scattered around. Will look into that.
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.
FYI, two more notes on this approach:
- We may end up double-booking our own channel liquidity, since we don't know which of our channels is being used inside the blinded path (double-booking liquidity is a general problem for blinded pathfinding anyway, though)
- ISTM we'll always want to go through the process of selecting additional paths, because the blinded path where we are the intro node may be the most expensive option
For (1), we could decrement each of our available channel balances by the amount used on the path. Not sure it's if worth the additional complexity.
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'm gonna address this in a follow-up since this PR is growing. IMO our offers code should still advance blinded paths before pathfinding to them, though adding the behavior you describe is good for keeping find_route
general-purpose
b181025
to
c90a259
Compare
Rebased to fix CI, also squashed. |
c90a259
to
8012de1
Compare
lightning/src/routing/router.rs
Outdated
fees: RoutingFees { | ||
base_msat: blinded_payinfo.fee_base_msat, | ||
proportional_millionths: blinded_payinfo.fee_proportional_millionths, |
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.
More of a comprehension question - if a recipient includes a dummy hop, we'll send extra sats for this dummy hop's fees that will go to the recipient right? Is there anything stopping a recipient from always making a sender slightly overpay as long as there's a route with enough liquidity?
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.
Dummy hops don't cost extra fees, since agregated fees for use of the entire blinded path are calculated by the recipient per https://github.com/lightning/bolts/blob/master/proposals/route-blinding.md#blinded-payments, based on the non-dummy hops' feerates. I think the recipient could make the sender overpay, though, if they just added extra fees on top of the aggregated fees?
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.
Dummy hops don't cost extra fees, since agregated fees for use of the entire blinded path are calculated by the recipient per https://github.com/lightning/bolts/blob/master/proposals/route-blinding.md#blinded-payments
Oh I see, thanks
I think the recipient could make the sender overpay, though, if they just added extra fees on top of the aggregated fees?
I realize reading more of the proposal that recipients are even encouraged to in order to avoid probing, although I also saw this section where the recipient pays the blinded fees which was interesting. But yea, seems like nothing's really stopping a recipient from getting the sender to overpay as long as its not outrageous...🤷
3329fe3
to
776bd7d
Compare
b59cf53
to
c2cc256
Compare
Squashed. |
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.
Largely looks good though I need to do a more detailed pass at the last commit still.
c2cc256
to
8d4b6da
Compare
To make it uniform with PaymentParameters' Payee::Blinded::route_hints.
8d4b6da
to
a02a157
Compare
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, I think, feel free to squash fixups.
a02a157
to
ddf497d
Compare
ddf497d
to
fcb6149
Compare
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.
One small thing worth fixing in a followup, though I'm not even sure the code is actually reachable.
It's unclear what values 1-hop blinded paths should set their BlindedPayInfos to, because those values are meant to refer to the fees/cltv delta on the path *between* the intro node and the destination. We zero out these values in the new variant's methods so they don't mess with path finding/construction.
We don't need to collect a vec of Results anymore.
Sending to them is still disallowed, for now.
fcb6149
to
6c3ca55
Compare
Support finding a route to a recipient who is behind blinded payment paths, which are provided in BOLT12 invoices.
Based on
#2258,#2305.