-
Notifications
You must be signed in to change notification settings - Fork 421
Fix panic in router given to bogus last-hop hints #958
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
Fix panic in router given to bogus last-hop hints #958
Conversation
Codecov Report
@@ Coverage Diff @@
## main #958 +/- ##
==========================================
+ Coverage 90.59% 92.08% +1.49%
==========================================
Files 60 60
Lines 30423 39616 +9193
==========================================
+ Hits 27561 36480 +8919
- Misses 2862 3136 +274
Continue to review full report at Codecov.
|
|
Maybe of your interest @naumenkogs :) ? |
|
If I had to guess this is actually a bug in the modifications I made to @naumenkogs' PR, not his bug, though my memory is a bit fuzzy. |
| // We should be able to send a payment to a destination without any help of a routing graph | ||
| // if we have a channel with a common counterparty that appears in the first and last hop | ||
| // hints. | ||
| let route = do_unannounced_path_test(None, 1, 2000000, 1000000).unwrap(); |
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.
Did these values need to be updated from what was used in the original test to exercise the same behavior?
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 don't see why they would?
7e1ba11 to
ee755d3
Compare
|
Squashed without diff: |
valentinewallace
left a 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.
Just nits pretty much. After a bit of staring, solution makes sense to me! Double checked and tests do panic without the patch in ways that align with the comments.
lightning/src/routing/router.rs
Outdated
| #[test] | ||
| fn overflow_unannounced_path_test_liquidity_underflow() { | ||
| // Previously, when we had a last-hop hint connected directly to a first-hop channel, where | ||
| // the last-hop had a value-overflowing fee, we'd panic. |
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 know if it's clear what "value-overflowing fee" is on first read. Is there a way to rephrase/clarify? 🤔 Also, should it be s/value-overflowing/value-underflowing?
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.
No, the fee overflowed the storage space. I rephrased slightly.
| $next_hops_value_contribution: expr, $next_hops_path_htlc_minimum_msat: expr ) => { | ||
| $next_hops_value_contribution: expr, $next_hops_path_htlc_minimum_msat: expr ) => { { | ||
| // We "return" whether we updated the path at the end, via this: | ||
| let mut did_add_update_path_to_src_node = false; |
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.
Does this mean did_add_or_update_path_to_src_node? (i.e. the "or" is implied?)
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 figure its implied - the block can only either add or update, but even if it did both the meaning would still hold.
See new comments and test cases for more info
ee755d3 to
2825d65
Compare
|
Very slightly tweaked comments and stray newlines, will merge after CI: |
See new comments and test cases for more info
Found by the router fuzz target.