diff --git a/lnwallet/channel_test.go b/lnwallet/channel_test.go index 29895f6f..d67d0981 100644 --- a/lnwallet/channel_test.go +++ b/lnwallet/channel_test.go @@ -2,9 +2,11 @@ package lnwallet import ( "bytes" + "crypto/rand" "crypto/sha256" + "encoding/binary" + "io" "io/ioutil" - "os" "reflect" "runtime" @@ -280,11 +282,21 @@ func createTestChannels(revocationWindow int) (*LightningChannel, CommitSig: bytes.Repeat([]byte{1}, 71), } + var chanIDBytes [8]byte + if _, err := io.ReadFull(rand.Reader, chanIDBytes[:]); err != nil { + return nil, nil, nil, err + } + + shortChanID := lnwire.NewShortChanIDFromInt( + binary.BigEndian.Uint64(chanIDBytes[:]), + ) + aliceChannelState := &channeldb.OpenChannel{ LocalChanCfg: aliceCfg, RemoteChanCfg: bobCfg, IdentityPub: aliceKeys[0].PubKey(), FundingOutpoint: *prevOut, + ShortChanID: shortChanID, ChanType: channeldb.SingleFunder, IsInitiator: true, Capacity: channelCapacity, @@ -294,12 +306,14 @@ func createTestChannels(revocationWindow int) (*LightningChannel, LocalCommitment: aliceCommit, RemoteCommitment: aliceCommit, Db: dbAlice, + Packager: channeldb.NewChannelPackager(shortChanID), } bobChannelState := &channeldb.OpenChannel{ LocalChanCfg: bobCfg, RemoteChanCfg: aliceCfg, IdentityPub: bobKeys[0].PubKey(), FundingOutpoint: *prevOut, + ShortChanID: shortChanID, ChanType: channeldb.SingleFunder, IsInitiator: false, Capacity: channelCapacity, @@ -309,6 +323,7 @@ func createTestChannels(revocationWindow int) (*LightningChannel, LocalCommitment: bobCommit, RemoteCommitment: bobCommit, Db: dbBob, + Packager: channeldb.NewChannelPackager(shortChanID), } aliceSigner := &mockSigner{privkeys: aliceKeys}