channeldb/channel_test: init with Pacakager and construct FwdPkgs

This commit is contained in:
Conner Fromknecht 2018-02-22 15:02:02 -08:00
parent 2df9fb5510
commit e4d2958f68
No known key found for this signature in database
GPG Key ID: 39DE78FBE6ACB0EF
1 changed files with 14 additions and 2 deletions

View File

@ -219,6 +219,7 @@ func createTestChannelState(cdb *DB) (*OpenChannel, error) {
RevocationProducer: producer,
RevocationStore: store,
Db: cdb,
Packager: NewChannelPackager(chanID),
}, nil
}
@ -475,6 +476,8 @@ func TestChannelStateTransition(t *testing.T) {
},
},
},
OpenedCircuitKeys: []CircuitKey{},
ClosedCircuitKeys: []CircuitKey{},
}
copy(commitDiff.LogUpdates[0].UpdateMsg.(*lnwire.UpdateAddHTLC).PaymentHash[:],
bytes.Repeat([]byte{1}, 32))
@ -509,7 +512,12 @@ func TestChannelStateTransition(t *testing.T) {
t.Fatalf("unable to generate key: %v", err)
}
channel.RemoteNextRevocation = newPriv.PubKey()
if err := channel.AdvanceCommitChainTail(); err != nil {
fwdPkg := NewFwdPkg(channel.ShortChanID, oldRemoteCommit.CommitHeight,
diskCommitDiff.LogUpdates, nil)
err = channel.AdvanceCommitChainTail(fwdPkg)
if err != nil {
t.Fatalf("unable to append to revocation log: %v", err)
}
@ -553,7 +561,11 @@ func TestChannelStateTransition(t *testing.T) {
if err := channel.AppendRemoteCommitChain(commitDiff); err != nil {
t.Fatalf("unable to add to commit chain: %v", err)
}
if err := channel.AdvanceCommitChainTail(); err != nil {
fwdPkg = NewFwdPkg(channel.ShortChanID, oldRemoteCommit.CommitHeight, nil, nil)
err = channel.AdvanceCommitChainTail(fwdPkg)
if err != nil {
t.Fatalf("unable to append to revocation log: %v", err)
}