mirror of
https://github.com/aljazceru/breez-lnd.git
synced 2025-12-18 14:44:22 +01:00
routing: fix node ordering in test graph
There is the general assumption that channel edge policy nodes are ordered such that the node1 pubkey is smaller than the key of node 2. In the test graph, this assumption didn't hold. This commit fixes the test graph and also adds a check to prevent this from happening again.
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"math/big"
|
||||
@@ -232,6 +233,13 @@ func parseTestGraph(path string) (*testGraphInstance, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if bytes.Compare(node1Bytes, node2Bytes) == 1 {
|
||||
return nil, fmt.Errorf(
|
||||
"channel %v node order incorrect",
|
||||
edge.ChannelID,
|
||||
)
|
||||
}
|
||||
|
||||
fundingTXID := strings.Split(edge.ChannelPoint, ":")[0]
|
||||
txidBytes, err := chainhash.NewHashFromStr(fundingTXID)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user