mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-11-28 15:13:04 +01:00
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:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/btcsuite/btcd/btcec/v2"
|
||||
"github.com/btcsuite/btcd/btcutil"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
@@ -13,7 +14,12 @@ import (
|
||||
|
||||
// createPubkey return a new test pubkey.
|
||||
func createPubkey(id byte) route.Vertex {
|
||||
pubkey := route.Vertex{id}
|
||||
_, secpPub := btcec.PrivKeyFromBytes([]byte{id})
|
||||
|
||||
var bytes [33]byte
|
||||
copy(bytes[:], secpPub.SerializeCompressed()[:33])
|
||||
|
||||
pubkey := route.Vertex(bytes)
|
||||
return pubkey
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user