routing+routerrpc: take max cltv limit into account within path finding
With the introduction of the max CLTV limit parameter, nodes are able to reject HTLCs that exceed it. This should also be applied to path finding, otherwise HTLCs crafted by the same node that exceed it never left the switch. This wasn't a big deal since the previous max CLTV limit was ~5000 blocks. Once it was lowered to 1008, the issue became more apparent. Therefore, all of our path finding attempts now have a restriction of said limit in in order to properly carry out HTLCs to the network.
This commit is contained in:
14 files changed
+75
-46
No files matched your search
+3
-3
@@ -260,7 +260,7 @@ type RestrictParams struct {
|
||||
// CltvLimit is the maximum time lock of the route excluding the final
|
||||
// ctlv. After path finding is complete, the caller needs to increase
|
||||
// all cltv expiry heights with the required final cltv delta.
|
||||
CltvLimit *uint32
|
||||
CltvLimit uint32
|
||||
|
||||
// DestPayloadTLV should be set to true if we need to drop off a TLV
|
||||
// payload at the final hop in order to properly complete this payment
|
||||
@@ -495,8 +495,8 @@ func findPath(g *graphParams, r *RestrictParams, cfg *PathFindingConfig,
|
||||
incomingCltv := toNodeDist.incomingCltv +
|
||||
uint32(timeLockDelta)
|
||||
|
||||
// Check that we have cltv limit and that we are within it.
|
||||
if r.CltvLimit != nil && incomingCltv > *r.CltvLimit {
|
||||
// Check that we are within our CLTV limit.
|
||||
if incomingCltv > r.CltvLimit {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user