channeldb/channel_test: init with Pacakager and construct FwdPkgs
This commit is contained in:
parent
2df9fb5510
commit
e4d2958f68
@ -219,6 +219,7 @@ func createTestChannelState(cdb *DB) (*OpenChannel, error) {
|
|||||||
RevocationProducer: producer,
|
RevocationProducer: producer,
|
||||||
RevocationStore: store,
|
RevocationStore: store,
|
||||||
Db: cdb,
|
Db: cdb,
|
||||||
|
Packager: NewChannelPackager(chanID),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -475,6 +476,8 @@ func TestChannelStateTransition(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
OpenedCircuitKeys: []CircuitKey{},
|
||||||
|
ClosedCircuitKeys: []CircuitKey{},
|
||||||
}
|
}
|
||||||
copy(commitDiff.LogUpdates[0].UpdateMsg.(*lnwire.UpdateAddHTLC).PaymentHash[:],
|
copy(commitDiff.LogUpdates[0].UpdateMsg.(*lnwire.UpdateAddHTLC).PaymentHash[:],
|
||||||
bytes.Repeat([]byte{1}, 32))
|
bytes.Repeat([]byte{1}, 32))
|
||||||
@ -509,7 +512,12 @@ func TestChannelStateTransition(t *testing.T) {
|
|||||||
t.Fatalf("unable to generate key: %v", err)
|
t.Fatalf("unable to generate key: %v", err)
|
||||||
}
|
}
|
||||||
channel.RemoteNextRevocation = newPriv.PubKey()
|
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)
|
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 {
|
if err := channel.AppendRemoteCommitChain(commitDiff); err != nil {
|
||||||
t.Fatalf("unable to add to commit chain: %v", err)
|
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)
|
t.Fatalf("unable to append to revocation log: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user