test_utils: init with packager
This commit is contained in:
parent
4f5edc1b2e
commit
1421a91767
@ -2,6 +2,9 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
crand "crypto/rand"
|
||||||
|
"encoding/binary"
|
||||||
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"net"
|
"net"
|
||||||
@ -191,11 +194,21 @@ func createTestPeer(notifier chainntnfs.ChainNotifier,
|
|||||||
CommitSig: bytes.Repeat([]byte{1}, 71),
|
CommitSig: bytes.Repeat([]byte{1}, 71),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var chanIDBytes [8]byte
|
||||||
|
if _, err := io.ReadFull(crand.Reader, chanIDBytes[:]); err != nil {
|
||||||
|
return nil, nil, nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
shortChanID := lnwire.NewShortChanIDFromInt(
|
||||||
|
binary.BigEndian.Uint64(chanIDBytes[:]),
|
||||||
|
)
|
||||||
|
|
||||||
aliceChannelState := &channeldb.OpenChannel{
|
aliceChannelState := &channeldb.OpenChannel{
|
||||||
LocalChanCfg: aliceCfg,
|
LocalChanCfg: aliceCfg,
|
||||||
RemoteChanCfg: bobCfg,
|
RemoteChanCfg: bobCfg,
|
||||||
IdentityPub: aliceKeyPub,
|
IdentityPub: aliceKeyPub,
|
||||||
FundingOutpoint: *prevOut,
|
FundingOutpoint: *prevOut,
|
||||||
|
ShortChanID: shortChanID,
|
||||||
ChanType: channeldb.SingleFunder,
|
ChanType: channeldb.SingleFunder,
|
||||||
IsInitiator: true,
|
IsInitiator: true,
|
||||||
Capacity: channelCapacity,
|
Capacity: channelCapacity,
|
||||||
@ -205,6 +218,7 @@ func createTestPeer(notifier chainntnfs.ChainNotifier,
|
|||||||
LocalCommitment: aliceCommit,
|
LocalCommitment: aliceCommit,
|
||||||
RemoteCommitment: aliceCommit,
|
RemoteCommitment: aliceCommit,
|
||||||
Db: dbAlice,
|
Db: dbAlice,
|
||||||
|
Packager: channeldb.NewChannelPackager(shortChanID),
|
||||||
}
|
}
|
||||||
bobChannelState := &channeldb.OpenChannel{
|
bobChannelState := &channeldb.OpenChannel{
|
||||||
LocalChanCfg: bobCfg,
|
LocalChanCfg: bobCfg,
|
||||||
@ -220,6 +234,7 @@ func createTestPeer(notifier chainntnfs.ChainNotifier,
|
|||||||
LocalCommitment: bobCommit,
|
LocalCommitment: bobCommit,
|
||||||
RemoteCommitment: bobCommit,
|
RemoteCommitment: bobCommit,
|
||||||
Db: dbBob,
|
Db: dbBob,
|
||||||
|
Packager: channeldb.NewChannelPackager(shortChanID),
|
||||||
}
|
}
|
||||||
|
|
||||||
addr := &net.TCPAddr{
|
addr := &net.TCPAddr{
|
||||||
@ -292,7 +307,8 @@ func createTestPeer(notifier chainntnfs.ChainNotifier,
|
|||||||
chainArb: chainArb,
|
chainArb: chainArb,
|
||||||
}
|
}
|
||||||
htlcSwitch, err := htlcswitch.New(htlcswitch.Config{
|
htlcSwitch, err := htlcswitch.New(htlcswitch.Config{
|
||||||
DB: dbAlice,
|
DB: dbAlice,
|
||||||
|
SwitchPackager: channeldb.NewSwitchPackager(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, nil, err
|
return nil, nil, nil, nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user