routing: Fix possible infinite loop on first hop misleading hint

Add ignore condition to additional edges that connect to self. These
edges are already known and avoiding these hints protect the payment
from malformed channel ids which could lead to infinite loop.

Fixes lightningnetwork#6169.

Co-authored-by: lsunsi <lsunsi@pm.me>
This commit is contained in:
andreihodandlsunsi committed 2022-11-11 04:23:55 -03:00
1 parent bcdf24b15e
commit befa1b7cf0
6 files changed
+176 -1

No files matched your search

@@ -10,6 +10,7 @@ import (
"github.com/lightningnetwork/lnd/kvdb"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/routing/route"
"github.com/lightningnetwork/lnd/zpay32"
)
const (
@@ -47,6 +48,7 @@ type integratedRoutingContext struct {
mcCfg MissionControlConfig
pathFindingCfg PathFindingConfig
routeHints [][]zpay32.HopHint
}
// newIntegratedRoutingContext instantiates a new integrated routing test
@@ -177,6 +179,7 @@ func (c *integratedRoutingContext) testPayment(maxParts uint32,
Amount: c.amt,
CltvLimit: math.MaxUint32,
MaxParts: maxParts,
RouteHints: c.routeHints,
}
var paymentHash [32]byte