diff --git a/routing/notifications_test.go b/routing/notifications_test.go index dbd9467a9..0a5cc393e 100644 --- a/routing/notifications_test.go +++ b/routing/notifications_test.go @@ -35,6 +35,8 @@ var ( 0x6a, 0x49, 0x18, 0x83, 0x31, 0x98, 0x47, 0x53, } + testTime = time.Date(2018, time.January, 9, 14, 00, 00, 0, time.UTC) + priv1, _ = btcec.NewPrivateKey(btcec.S256()) bitcoinKey1 = priv1.PubKey() diff --git a/routing/pathfind_test.go b/routing/pathfind_test.go index c5e415019..8180aa07a 100644 --- a/routing/pathfind_test.go +++ b/routing/pathfind_test.go @@ -14,7 +14,6 @@ import ( "os" "strings" "testing" - "time" "github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/chaincfg/chainhash" @@ -22,8 +21,6 @@ import ( "github.com/btcsuite/btcutil" "github.com/lightningnetwork/lnd/channeldb" "github.com/lightningnetwork/lnd/lnwire" - - prand "math/rand" ) const ( @@ -50,9 +47,7 @@ const ( ) var ( - randSource = prand.NewSource(time.Now().Unix()) - randInts = prand.New(randSource) - testSig = &btcec.Signature{ + testSig = &btcec.Signature{ R: new(big.Int), S: new(big.Int), } @@ -176,7 +171,7 @@ func parseTestGraph(path string) (*channeldb.ChannelGraph, func(), aliasMap, err dbNode := &channeldb.LightningNode{ HaveNodeAnnouncement: true, AuthSigBytes: testSig.Serialize(), - LastUpdate: time.Now(), + LastUpdate: testTime, Addresses: testAddrs, Alias: node.Alias, Features: testFeatures, @@ -275,7 +270,7 @@ func parseTestGraph(path string) (*channeldb.ChannelGraph, func(), aliasMap, err SigBytes: testSig.Serialize(), Flags: lnwire.ChanUpdateFlag(edge.Flags), ChannelID: edge.ChannelID, - LastUpdate: time.Now(), + LastUpdate: testTime, TimeLockDelta: edge.Expiry, MinHTLC: lnwire.MilliSatoshi(edge.MinHTLC), FeeBaseMSat: lnwire.MilliSatoshi(edge.FeeBaseMsat), @@ -374,7 +369,7 @@ func createTestGraph(testChannels []*testChannel) (*channeldb.ChannelGraph, func dbNode := &channeldb.LightningNode{ HaveNodeAnnouncement: true, AuthSigBytes: testSig.Serialize(), - LastUpdate: time.Now(), + LastUpdate: testTime, Addresses: testAddrs, Alias: alias, Features: testFeatures, @@ -449,7 +444,7 @@ func createTestGraph(testChannels []*testChannel) (*channeldb.ChannelGraph, func SigBytes: testSig.Serialize(), Flags: lnwire.ChanUpdateFlag(0), ChannelID: channelID, - LastUpdate: time.Now(), + LastUpdate: testTime, TimeLockDelta: testChannel.Node1.Expiry, MinHTLC: testChannel.Node1.MinHTLC, FeeBaseMSat: testChannel.Node1.FeeBaseMsat, @@ -463,7 +458,7 @@ func createTestGraph(testChannels []*testChannel) (*channeldb.ChannelGraph, func SigBytes: testSig.Serialize(), Flags: lnwire.ChanUpdateFlag(lnwire.ChanUpdateDirection), ChannelID: channelID, - LastUpdate: time.Now(), + LastUpdate: testTime, TimeLockDelta: testChannel.Node2.Expiry, MinHTLC: testChannel.Node2.MinHTLC, FeeBaseMSat: testChannel.Node2.FeeBaseMsat, diff --git a/routing/router_test.go b/routing/router_test.go index 0c9492bef..4ad37b675 100644 --- a/routing/router_test.go +++ b/routing/router_test.go @@ -910,7 +910,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) { edgePolicy := &channeldb.ChannelEdgePolicy{ SigBytes: testSig.Serialize(), ChannelID: edge.ChannelID, - LastUpdate: time.Now(), + LastUpdate: testTime, TimeLockDelta: 10, MinHTLC: 1, FeeBaseMSat: 10, @@ -926,7 +926,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) { edgePolicy = &channeldb.ChannelEdgePolicy{ SigBytes: testSig.Serialize(), ChannelID: edge.ChannelID, - LastUpdate: time.Now(), + LastUpdate: testTime, TimeLockDelta: 10, MinHTLC: 1, FeeBaseMSat: 10, @@ -1006,7 +1006,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) { edgePolicy = &channeldb.ChannelEdgePolicy{ SigBytes: testSig.Serialize(), ChannelID: edge.ChannelID, - LastUpdate: time.Now(), + LastUpdate: testTime, TimeLockDelta: 10, MinHTLC: 1, FeeBaseMSat: 10, @@ -1021,7 +1021,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) { edgePolicy = &channeldb.ChannelEdgePolicy{ SigBytes: testSig.Serialize(), ChannelID: edge.ChannelID, - LastUpdate: time.Now(), + LastUpdate: testTime, TimeLockDelta: 10, MinHTLC: 1, FeeBaseMSat: 10,