lnwallet: account for case where remote party has 2 unrevoked commits in DLP

This commit is contained in:
Olaoluwa Osuntokun committed 2019-03-28 17:53:55 -07:00
1 parent fc8337b146
commit 4ff4e1b0de
1 file changed
+10
+10
View File
@@ -3501,7 +3501,16 @@ func (lc *LightningChannel) ProcessChanSyncMsg(
// as that's what they should send.
case msg.NextLocalCommitHeight == remoteTailHeight+1:
commitPoint = lc.channelState.RemoteCurrentRevocation
// Alternatively, if their height is two beyond what we know their best
// height to be, then they're holding onto two commitments, and the
// highest unrevoked point it their next revocation.
//
// TODO(roasbeef): verify this in the spec...
case msg.NextLocalCommitHeight == remoteTailHeight+2:
commitPoint = lc.channelState.RemoteNextRevocation
}
if commitPoint != nil &&
!commitPoint.IsEqual(msg.LocalUnrevokedCommitPoint) {
@@ -3513,6 +3522,7 @@ func (lc *LightningChannel) ProcessChanSyncMsg(
if err := lc.channelState.MarkBorked(); err != nil {
return nil, nil, nil, err
}
// TODO(halseth): force close?
return nil, nil, nil, ErrInvalidLocalUnrevokedCommitPoint
}