channeldb: extend set of graph tests to include opque data where pertinent
This commit is contained in:
parent
f5c582d8d7
commit
a35bdd4233
@ -87,6 +87,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) {
|
|||||||
Alias: "kek",
|
Alias: "kek",
|
||||||
Features: testFeatures,
|
Features: testFeatures,
|
||||||
Addresses: testAddrs,
|
Addresses: testAddrs,
|
||||||
|
ExtraOpaqueData: []byte("extra new data"),
|
||||||
db: db,
|
db: db,
|
||||||
}
|
}
|
||||||
copy(node.PubKeyBytes[:], testPub.SerializeCompressed())
|
copy(node.PubKeyBytes[:], testPub.SerializeCompressed())
|
||||||
@ -614,6 +615,11 @@ func assertEdgeInfoEqual(t *testing.T, e1 *ChannelEdgeInfo,
|
|||||||
t.Fatalf("capacity doesn't match: %v vs %v", e1.Capacity,
|
t.Fatalf("capacity doesn't match: %v vs %v", e1.Capacity,
|
||||||
e2.Capacity)
|
e2.Capacity)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !bytes.Equal(e1.ExtraOpaqueData, e2.ExtraOpaqueData) {
|
||||||
|
t.Fatalf("extra data doesn't match: %v vs %v",
|
||||||
|
e2.ExtraOpaqueData, e2.ExtraOpaqueData)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEdgeInfoUpdates(t *testing.T) {
|
func TestEdgeInfoUpdates(t *testing.T) {
|
||||||
@ -677,6 +683,7 @@ func TestEdgeInfoUpdates(t *testing.T) {
|
|||||||
},
|
},
|
||||||
ChannelPoint: outpoint,
|
ChannelPoint: outpoint,
|
||||||
Capacity: 1000,
|
Capacity: 1000,
|
||||||
|
ExtraOpaqueData: []byte("new unknown feature"),
|
||||||
}
|
}
|
||||||
copy(edgeInfo.NodeKey1Bytes[:], firstNode.PubKeyBytes[:])
|
copy(edgeInfo.NodeKey1Bytes[:], firstNode.PubKeyBytes[:])
|
||||||
copy(edgeInfo.NodeKey2Bytes[:], secondNode.PubKeyBytes[:])
|
copy(edgeInfo.NodeKey2Bytes[:], secondNode.PubKeyBytes[:])
|
||||||
@ -698,6 +705,7 @@ func TestEdgeInfoUpdates(t *testing.T) {
|
|||||||
FeeBaseMSat: 4352345,
|
FeeBaseMSat: 4352345,
|
||||||
FeeProportionalMillionths: 3452352,
|
FeeProportionalMillionths: 3452352,
|
||||||
Node: secondNode,
|
Node: secondNode,
|
||||||
|
ExtraOpaqueData: []byte("new unknown feature2"),
|
||||||
db: db,
|
db: db,
|
||||||
}
|
}
|
||||||
edge2 := &ChannelEdgePolicy{
|
edge2 := &ChannelEdgePolicy{
|
||||||
@ -710,6 +718,7 @@ func TestEdgeInfoUpdates(t *testing.T) {
|
|||||||
FeeBaseMSat: 4352345,
|
FeeBaseMSat: 4352345,
|
||||||
FeeProportionalMillionths: 90392423,
|
FeeProportionalMillionths: 90392423,
|
||||||
Node: firstNode,
|
Node: firstNode,
|
||||||
|
ExtraOpaqueData: []byte("new unknown feature1"),
|
||||||
db: db,
|
db: db,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2460,6 +2469,10 @@ func compareNodes(a, b *LightningNode) error {
|
|||||||
return fmt.Errorf("HaveNodeAnnouncement doesn't match: expected %#v, \n "+
|
return fmt.Errorf("HaveNodeAnnouncement doesn't match: expected %#v, \n "+
|
||||||
"got %#v", a.HaveNodeAnnouncement, b.HaveNodeAnnouncement)
|
"got %#v", a.HaveNodeAnnouncement, b.HaveNodeAnnouncement)
|
||||||
}
|
}
|
||||||
|
if !bytes.Equal(a.ExtraOpaqueData, b.ExtraOpaqueData) {
|
||||||
|
return fmt.Errorf("extra data doesn't match: %v vs %v",
|
||||||
|
a.ExtraOpaqueData, b.ExtraOpaqueData)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -2496,6 +2509,10 @@ func compareEdgePolicies(a, b *ChannelEdgePolicy) error {
|
|||||||
"expected %v, got %v", a.FeeProportionalMillionths,
|
"expected %v, got %v", a.FeeProportionalMillionths,
|
||||||
b.FeeProportionalMillionths)
|
b.FeeProportionalMillionths)
|
||||||
}
|
}
|
||||||
|
if !bytes.Equal(a.ExtraOpaqueData, b.ExtraOpaqueData) {
|
||||||
|
return fmt.Errorf("extra data doesn't match: %v vs %v",
|
||||||
|
a.ExtraOpaqueData, b.ExtraOpaqueData)
|
||||||
|
}
|
||||||
if err := compareNodes(a.Node, b.Node); err != nil {
|
if err := compareNodes(a.Node, b.Node); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user