channeldb/graph_test: ensure policies for an edge have different

timestamps

In this commit, we ensure policies for edges we create in
TestChanUpdatesInHorizon have different update timestamps. This ensures
that there are two entries per edge in the edge update index. Because of
this, the test will fail because ChanUpdatesInHorizon will return
duplicate channel edges due to looking at all the entries within the
edge update index. This will be addressed in a future commit to allow
the set of tests to pass once again.
This commit is contained in:
Wilmer Paulino 2018-09-04 18:36:25 -07:00
parent 1217992d9d
commit d3cf3168d2
No known key found for this signature in database
GPG Key ID: 6DF57B9F9514972F

@ -1398,11 +1398,12 @@ func TestChanUpdatesInHorizon(t *testing.T) {
t.Fatalf("unable to create channel edge: %v", err) t.Fatalf("unable to create channel edge: %v", err)
} }
updateTime := endTime edge1UpdateTime := endTime
endTime = updateTime.Add(time.Second * 10) edge2UpdateTime := edge1UpdateTime.Add(time.Second)
endTime = endTime.Add(time.Second * 10)
edge1 := newEdgePolicy( edge1 := newEdgePolicy(
chanID.ToUint64(), op, db, updateTime.Unix(), chanID.ToUint64(), op, db, edge1UpdateTime.Unix(),
) )
edge1.Flags = 0 edge1.Flags = 0
edge1.Node = node2 edge1.Node = node2
@ -1412,7 +1413,7 @@ func TestChanUpdatesInHorizon(t *testing.T) {
} }
edge2 := newEdgePolicy( edge2 := newEdgePolicy(
chanID.ToUint64(), op, db, updateTime.Unix(), chanID.ToUint64(), op, db, edge2UpdateTime.Unix(),
) )
edge2.Flags = 1 edge2.Flags = 1
edge2.Node = node1 edge2.Node = node1