mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-09-30 19:42:53 +02:00
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:
@@ -248,11 +248,14 @@ func (s *Server) EstimateRouteFee(ctx context.Context,
|
||||
feeLimit := lnwire.NewMSatFromSatoshis(btcutil.SatoshiPerBitcoin)
|
||||
|
||||
// Finally, we'll query for a route to the destination that can carry
|
||||
// that target amount, we'll only request a single route.
|
||||
// that target amount, we'll only request a single route. Set a
|
||||
// restriction for the default CLTV limit, otherwise we can find a route
|
||||
// that exceeds it and is useless to us.
|
||||
route, err := s.cfg.Router.FindRoute(
|
||||
s.cfg.RouterBackend.SelfNode, destNode, amtMsat,
|
||||
&routing.RestrictParams{
|
||||
FeeLimit: feeLimit,
|
||||
FeeLimit: feeLimit,
|
||||
CltvLimit: s.cfg.RouterBackend.MaxTotalTimelock,
|
||||
}, nil,
|
||||
)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user