From 8dd074ee57f6570e371787260b2a9624d7c594a1 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Sat, 12 Jan 2019 18:59:44 +0100 Subject: [PATCH] channeldb/graph_test: assert MaxHTLC field correctness Co-authored-by: Valentine Wallace --- channeldb/graph_test.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/channeldb/graph_test.go b/channeldb/graph_test.go index 6b3287ba4..16e50b674 100644 --- a/channeldb/graph_test.go +++ b/channeldb/graph_test.go @@ -699,10 +699,11 @@ func TestEdgeInfoUpdates(t *testing.T) { SigBytes: testSig.Serialize(), ChannelID: chanID, LastUpdate: time.Unix(433453, 0), - MessageFlags: 0, + MessageFlags: 1, ChannelFlags: 0, TimeLockDelta: 99, MinHTLC: 2342135, + MaxHTLC: 13928598, FeeBaseMSat: 4352345, FeeProportionalMillionths: 3452352, Node: secondNode, @@ -713,10 +714,11 @@ func TestEdgeInfoUpdates(t *testing.T) { SigBytes: testSig.Serialize(), ChannelID: chanID, LastUpdate: time.Unix(124234, 0), - MessageFlags: 0, + MessageFlags: 1, ChannelFlags: 1, TimeLockDelta: 99, MinHTLC: 2342135, + MaxHTLC: 13928598, FeeBaseMSat: 4352345, FeeProportionalMillionths: 90392423, Node: firstNode, @@ -794,10 +796,11 @@ func newEdgePolicy(chanID uint64, op wire.OutPoint, db *DB, return &ChannelEdgePolicy{ ChannelID: chanID, LastUpdate: time.Unix(updateTime, 0), - MessageFlags: 0, + MessageFlags: 1, ChannelFlags: 0, TimeLockDelta: uint16(prand.Int63()), MinHTLC: lnwire.MilliSatoshi(prand.Int63()), + MaxHTLC: lnwire.MilliSatoshi(prand.Int63()), FeeBaseMSat: lnwire.MilliSatoshi(prand.Int63()), FeeProportionalMillionths: lnwire.MilliSatoshi(prand.Int63()), db: db, @@ -2665,6 +2668,10 @@ func compareEdgePolicies(a, b *ChannelEdgePolicy) error { return fmt.Errorf("MinHTLC doesn't match: expected %v, "+ "got %v", a.MinHTLC, b.MinHTLC) } + if a.MaxHTLC != b.MaxHTLC { + return fmt.Errorf("MaxHTLC doesn't match: expected %v, "+ + "got %v", a.MaxHTLC, b.MaxHTLC) + } if a.FeeBaseMSat != b.FeeBaseMSat { return fmt.Errorf("FeeBaseMSat doesn't match: expected %v, "+ "got %v", a.FeeBaseMSat, b.FeeBaseMSat)