lnwallet+htlcswitch: add NewCommitState struct, modify send/recv sig to accept
In this commit, we add a new NewCommitState struct. This preps us for the future change wherein a partial signature is also added to the mix. All related tests and type signatures have also been updated accordingly.
This commit is contained in:
9 files changed
+342
-322
No files matched your search
+9
-6
@@ -1899,7 +1899,10 @@ func (l *channelLink) handleUpstreamMsg(msg lnwire.Message) {
|
||||
// We just received a new updates to our local commitment
|
||||
// chain, validate this new commitment, closing the link if
|
||||
// invalid.
|
||||
err = l.channel.ReceiveNewCommitment(msg.CommitSig, msg.HtlcSigs)
|
||||
err = l.channel.ReceiveNewCommitment(&lnwallet.CommitSigs{
|
||||
CommitSig: msg.CommitSig,
|
||||
HtlcSigs: msg.HtlcSigs,
|
||||
})
|
||||
if err != nil {
|
||||
// If we were unable to reconstruct their proposed
|
||||
// commitment, then we'll examine the type of error. If
|
||||
@@ -2215,7 +2218,7 @@ func (l *channelLink) updateCommitTx() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
theirCommitSig, htlcSigs, pendingHTLCs, err := l.channel.SignNextCommitment()
|
||||
newCommit, err := l.channel.SignNextCommitment()
|
||||
if err == lnwallet.ErrNoWindow {
|
||||
l.cfg.PendingCommitTicker.Resume()
|
||||
l.log.Trace("PendingCommitTicker resumed")
|
||||
@@ -2247,7 +2250,7 @@ func (l *channelLink) updateCommitTx() error {
|
||||
// pending).
|
||||
newUpdate := &contractcourt.ContractUpdate{
|
||||
HtlcKey: contractcourt.RemotePendingHtlcSet,
|
||||
Htlcs: pendingHTLCs,
|
||||
Htlcs: newCommit.PendingHTLCs,
|
||||
}
|
||||
err = l.cfg.NotifyContractUpdate(newUpdate)
|
||||
if err != nil {
|
||||
@@ -2262,9 +2265,9 @@ func (l *channelLink) updateCommitTx() error {
|
||||
}
|
||||
|
||||
commitSig := &lnwire.CommitSig{
|
||||
ChanID: l.ChanID(),
|
||||
CommitSig: theirCommitSig,
|
||||
HtlcSigs: htlcSigs,
|
||||
ChanID: l.ChanID(),
|
||||
CommitSig: newCommit.CommitSig,
|
||||
HtlcSigs: newCommit.HtlcSigs,
|
||||
}
|
||||
l.cfg.Peer.SendMessage(false, commitSig)
|
||||
|
||||
|
||||
Reference in new issue
Block a user