-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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: improve BuildRoute robustness #6912
base: master
Are you sure you want to change the base?
Conversation
f7b172c
to
121a5b5
Compare
fix min htlc newroute
Sanity check to prevent invalid routes from being constructed.
With newRoute being aware of min_htlc constraints, there is no more need to do a forward pass in BuildRoute. This also fixes potential edge cases where the forward pass gets to a payment amount that still violates htlc ranges. The downside of this simplification is that more value may be dropped off along the path as fees rather than paying extra to the final hop. However, as the primary intention of the BuildRoute `min_amt` flag is to allow for cheap probes, this change is likely to have no consequences.
121a5b5
to
4f6cde9
Compare
} | ||
|
||
pathEdges = append(pathEdges, policy) | ||
edges[i] = policy | ||
} | ||
|
||
// Build and return the final route. | ||
return newRoute( |
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 am considering doing away with newRoute
completely. BuildRoute
already steps though the hops and could just as well build the final route structure on the fly. This would also uncover potential bugs in BuildRoute
that are later smoothed over in the final newRoute
pass.
For pathfinding this may be even more relevant. If pathfinding chooses a sub-optimal path because of a bug, newRoute
may fix it without anyone noticing.
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.
Implemented alternative in #6920
@bitromortac: review reminder |
Applies the
min_htlc
channel policy innewRoute
. Some routes cannot be reconstructed purely based on the final payment amount.Additionally a sanity check for
max_htlc
is added.With these changes, if becomes possible to simplify
BuildRoute
and remove the possibility of running into edge cases aroundmin_htlc
.A follow-up to this is to let pathfinding consider channels that have a
min_htlc
above the running amount. This would for example allow a user to complete a 100 msat payment via a channel that has a 1000 msatmin_htlc
. The difference is paid in fees.