breacharbiter_test: init open channels with Pacakager

This commit is contained in:
Conner Fromknecht 2018-02-23 19:28:36 -08:00
parent 6e542d5dfa
commit 970006ff2a
No known key found for this signature in database
GPG Key ID: 39DE78FBE6ACB0EF

View File

@ -4,8 +4,11 @@ package main
import (
"bytes"
crand "crypto/rand"
"crypto/sha256"
"encoding/binary"
"fmt"
"io"
"io/ioutil"
"math/rand"
"net"
@ -1384,6 +1387,15 @@ func createInitChannels(revocationWindow int) (*lnwallet.LightningChannel, *lnwa
CommitSig: bytes.Repeat([]byte{1}, 71),
}
var chanIDBytes [8]byte
if _, err := io.ReadFull(crand.Reader, chanIDBytes[:]); err != nil {
return nil, nil, nil, err
}
shortChanID := lnwire.NewShortChanIDFromInt(
binary.BigEndian.Uint64(chanIDBytes[:]),
)
aliceChannelState := &channeldb.OpenChannel{
LocalChanCfg: aliceCfg,
RemoteChanCfg: bobCfg,
@ -1398,6 +1410,7 @@ func createInitChannels(revocationWindow int) (*lnwallet.LightningChannel, *lnwa
LocalCommitment: aliceCommit,
RemoteCommitment: aliceCommit,
Db: dbAlice,
Packager: channeldb.NewChannelPackager(shortChanID),
}
bobChannelState := &channeldb.OpenChannel{
LocalChanCfg: bobCfg,
@ -1413,6 +1426,7 @@ func createInitChannels(revocationWindow int) (*lnwallet.LightningChannel, *lnwa
LocalCommitment: bobCommit,
RemoteCommitment: bobCommit,
Db: dbBob,
Packager: channeldb.NewChannelPackager(shortChanID),
}
pCache := &mockPreimageCache{