-
Notifications
You must be signed in to change notification settings - Fork 404
Avoid looping CLTV shadow routes. #1360
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
Avoid looping CLTV shadow routes. #1360
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1360 +/- ##
==========================================
- Coverage 90.77% 90.75% -0.02%
==========================================
Files 73 73
Lines 41062 41069 +7
Branches 41062 41069 +7
==========================================
+ Hits 37272 37273 +1
- Misses 3790 3796 +6
Continue to review full report at Codecov.
|
5c48f4d
to
2adbbfd
Compare
Since the fuzzer was failing at a related point, I now rebased this off #1358. |
Sorry about the fuzz failure, #1358 landed now so feel free to rebase. |
2adbbfd
to
e3e437d
Compare
No apology necessary, especially in this case... Rebased on main now. |
e3e437d
to
a26083e
Compare
Overall looks good. Fine with squashing and merging as is. Just want to note my observation that |
eb5a4c4
to
6b84c7e
Compare
Rebased and squashed. |
Looks like github actions are acting up. Could you run the following?
|
Hmm, did you have to rebase? Please don't rebase unless there's an actual conflict as it means reviewers can't as easily compare to the previous state. |
6b84c7e
to
11c3120
Compare
Done!
Ah, sorry, didn't realize that. Will keep in mind. |
This PR is a follow-up to #1286: it avoids 'shadow route' random walks that loop back on the actual payment path, since such paths are implausible from an adversary's perspective.
With this I also simplified the code a bit and opted to always generate a random shadow route of a certain length. When no suitable offset can be retrieved from the (unvisited) public network graph, the hop offset is filled with the default of
MEDIAN_HOP_CLTV_EXPIRY_DELTA == 40
to simulate a partially private path.As however already noted in #1286, such loopless random walks tend to be less diverse. For example, in the small test scenario generated by
build_graph()
, this implementation now basically always uses the fallback value since it's running out of options. It should also be noted that in order not to reduce the set of candidate paths even further, I now opted to account for visited nodes on per-path basis, i.e., crossing the streams is still possible for MPPs.