routing: use fixed time value in tests
This commit is contained in:
parent
1941353fb2
commit
2d255e3bc3
@ -35,6 +35,8 @@ var (
|
|||||||
0x6a, 0x49, 0x18, 0x83, 0x31, 0x98, 0x47, 0x53,
|
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())
|
priv1, _ = btcec.NewPrivateKey(btcec.S256())
|
||||||
bitcoinKey1 = priv1.PubKey()
|
bitcoinKey1 = priv1.PubKey()
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/btcec"
|
"github.com/btcsuite/btcd/btcec"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
@ -22,8 +21,6 @@ import (
|
|||||||
"github.com/btcsuite/btcutil"
|
"github.com/btcsuite/btcutil"
|
||||||
"github.com/lightningnetwork/lnd/channeldb"
|
"github.com/lightningnetwork/lnd/channeldb"
|
||||||
"github.com/lightningnetwork/lnd/lnwire"
|
"github.com/lightningnetwork/lnd/lnwire"
|
||||||
|
|
||||||
prand "math/rand"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -50,9 +47,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
randSource = prand.NewSource(time.Now().Unix())
|
testSig = &btcec.Signature{
|
||||||
randInts = prand.New(randSource)
|
|
||||||
testSig = &btcec.Signature{
|
|
||||||
R: new(big.Int),
|
R: new(big.Int),
|
||||||
S: new(big.Int),
|
S: new(big.Int),
|
||||||
}
|
}
|
||||||
@ -176,7 +171,7 @@ func parseTestGraph(path string) (*channeldb.ChannelGraph, func(), aliasMap, err
|
|||||||
dbNode := &channeldb.LightningNode{
|
dbNode := &channeldb.LightningNode{
|
||||||
HaveNodeAnnouncement: true,
|
HaveNodeAnnouncement: true,
|
||||||
AuthSigBytes: testSig.Serialize(),
|
AuthSigBytes: testSig.Serialize(),
|
||||||
LastUpdate: time.Now(),
|
LastUpdate: testTime,
|
||||||
Addresses: testAddrs,
|
Addresses: testAddrs,
|
||||||
Alias: node.Alias,
|
Alias: node.Alias,
|
||||||
Features: testFeatures,
|
Features: testFeatures,
|
||||||
@ -275,7 +270,7 @@ func parseTestGraph(path string) (*channeldb.ChannelGraph, func(), aliasMap, err
|
|||||||
SigBytes: testSig.Serialize(),
|
SigBytes: testSig.Serialize(),
|
||||||
Flags: lnwire.ChanUpdateFlag(edge.Flags),
|
Flags: lnwire.ChanUpdateFlag(edge.Flags),
|
||||||
ChannelID: edge.ChannelID,
|
ChannelID: edge.ChannelID,
|
||||||
LastUpdate: time.Now(),
|
LastUpdate: testTime,
|
||||||
TimeLockDelta: edge.Expiry,
|
TimeLockDelta: edge.Expiry,
|
||||||
MinHTLC: lnwire.MilliSatoshi(edge.MinHTLC),
|
MinHTLC: lnwire.MilliSatoshi(edge.MinHTLC),
|
||||||
FeeBaseMSat: lnwire.MilliSatoshi(edge.FeeBaseMsat),
|
FeeBaseMSat: lnwire.MilliSatoshi(edge.FeeBaseMsat),
|
||||||
@ -374,7 +369,7 @@ func createTestGraph(testChannels []*testChannel) (*channeldb.ChannelGraph, func
|
|||||||
dbNode := &channeldb.LightningNode{
|
dbNode := &channeldb.LightningNode{
|
||||||
HaveNodeAnnouncement: true,
|
HaveNodeAnnouncement: true,
|
||||||
AuthSigBytes: testSig.Serialize(),
|
AuthSigBytes: testSig.Serialize(),
|
||||||
LastUpdate: time.Now(),
|
LastUpdate: testTime,
|
||||||
Addresses: testAddrs,
|
Addresses: testAddrs,
|
||||||
Alias: alias,
|
Alias: alias,
|
||||||
Features: testFeatures,
|
Features: testFeatures,
|
||||||
@ -449,7 +444,7 @@ func createTestGraph(testChannels []*testChannel) (*channeldb.ChannelGraph, func
|
|||||||
SigBytes: testSig.Serialize(),
|
SigBytes: testSig.Serialize(),
|
||||||
Flags: lnwire.ChanUpdateFlag(0),
|
Flags: lnwire.ChanUpdateFlag(0),
|
||||||
ChannelID: channelID,
|
ChannelID: channelID,
|
||||||
LastUpdate: time.Now(),
|
LastUpdate: testTime,
|
||||||
TimeLockDelta: testChannel.Node1.Expiry,
|
TimeLockDelta: testChannel.Node1.Expiry,
|
||||||
MinHTLC: testChannel.Node1.MinHTLC,
|
MinHTLC: testChannel.Node1.MinHTLC,
|
||||||
FeeBaseMSat: testChannel.Node1.FeeBaseMsat,
|
FeeBaseMSat: testChannel.Node1.FeeBaseMsat,
|
||||||
@ -463,7 +458,7 @@ func createTestGraph(testChannels []*testChannel) (*channeldb.ChannelGraph, func
|
|||||||
SigBytes: testSig.Serialize(),
|
SigBytes: testSig.Serialize(),
|
||||||
Flags: lnwire.ChanUpdateFlag(lnwire.ChanUpdateDirection),
|
Flags: lnwire.ChanUpdateFlag(lnwire.ChanUpdateDirection),
|
||||||
ChannelID: channelID,
|
ChannelID: channelID,
|
||||||
LastUpdate: time.Now(),
|
LastUpdate: testTime,
|
||||||
TimeLockDelta: testChannel.Node2.Expiry,
|
TimeLockDelta: testChannel.Node2.Expiry,
|
||||||
MinHTLC: testChannel.Node2.MinHTLC,
|
MinHTLC: testChannel.Node2.MinHTLC,
|
||||||
FeeBaseMSat: testChannel.Node2.FeeBaseMsat,
|
FeeBaseMSat: testChannel.Node2.FeeBaseMsat,
|
||||||
|
@ -910,7 +910,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
|
|||||||
edgePolicy := &channeldb.ChannelEdgePolicy{
|
edgePolicy := &channeldb.ChannelEdgePolicy{
|
||||||
SigBytes: testSig.Serialize(),
|
SigBytes: testSig.Serialize(),
|
||||||
ChannelID: edge.ChannelID,
|
ChannelID: edge.ChannelID,
|
||||||
LastUpdate: time.Now(),
|
LastUpdate: testTime,
|
||||||
TimeLockDelta: 10,
|
TimeLockDelta: 10,
|
||||||
MinHTLC: 1,
|
MinHTLC: 1,
|
||||||
FeeBaseMSat: 10,
|
FeeBaseMSat: 10,
|
||||||
@ -926,7 +926,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
|
|||||||
edgePolicy = &channeldb.ChannelEdgePolicy{
|
edgePolicy = &channeldb.ChannelEdgePolicy{
|
||||||
SigBytes: testSig.Serialize(),
|
SigBytes: testSig.Serialize(),
|
||||||
ChannelID: edge.ChannelID,
|
ChannelID: edge.ChannelID,
|
||||||
LastUpdate: time.Now(),
|
LastUpdate: testTime,
|
||||||
TimeLockDelta: 10,
|
TimeLockDelta: 10,
|
||||||
MinHTLC: 1,
|
MinHTLC: 1,
|
||||||
FeeBaseMSat: 10,
|
FeeBaseMSat: 10,
|
||||||
@ -1006,7 +1006,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
|
|||||||
edgePolicy = &channeldb.ChannelEdgePolicy{
|
edgePolicy = &channeldb.ChannelEdgePolicy{
|
||||||
SigBytes: testSig.Serialize(),
|
SigBytes: testSig.Serialize(),
|
||||||
ChannelID: edge.ChannelID,
|
ChannelID: edge.ChannelID,
|
||||||
LastUpdate: time.Now(),
|
LastUpdate: testTime,
|
||||||
TimeLockDelta: 10,
|
TimeLockDelta: 10,
|
||||||
MinHTLC: 1,
|
MinHTLC: 1,
|
||||||
FeeBaseMSat: 10,
|
FeeBaseMSat: 10,
|
||||||
@ -1021,7 +1021,7 @@ func TestAddEdgeUnknownVertexes(t *testing.T) {
|
|||||||
edgePolicy = &channeldb.ChannelEdgePolicy{
|
edgePolicy = &channeldb.ChannelEdgePolicy{
|
||||||
SigBytes: testSig.Serialize(),
|
SigBytes: testSig.Serialize(),
|
||||||
ChannelID: edge.ChannelID,
|
ChannelID: edge.ChannelID,
|
||||||
LastUpdate: time.Now(),
|
LastUpdate: testTime,
|
||||||
TimeLockDelta: 10,
|
TimeLockDelta: 10,
|
||||||
MinHTLC: 1,
|
MinHTLC: 1,
|
||||||
FeeBaseMSat: 10,
|
FeeBaseMSat: 10,
|
||||||
|
Loading…
Reference in New Issue
Block a user