lnwallet: update ReceiveRevocation to use new DB API's
We no longer need to manually pass in the channel delta to AppendToRevocationLog (now called AdvanceCommitChainTail) as the pointers on-disk will be updated atomically.
This commit is contained in:
parent
4fa714afce
commit
b50a94aeab
@ -3555,13 +3555,9 @@ func (lc *LightningChannel) ReceiveRevocation(revMsg *lnwire.RevokeAndAck) ([]*P
|
|||||||
// At this point, the revocation has been accepted, and we've rotated
|
// At this point, the revocation has been accepted, and we've rotated
|
||||||
// the current revocation key+hash for the remote party. Therefore we
|
// the current revocation key+hash for the remote party. Therefore we
|
||||||
// sync now to ensure the revocation producer state is consistent with
|
// sync now to ensure the revocation producer state is consistent with
|
||||||
// the current commitment height.
|
// the current commitment height and also to advance the on-disk
|
||||||
tail := lc.remoteCommitChain.tail()
|
// commitment chain.
|
||||||
delta, err := tail.toChannelDelta(false)
|
if err := lc.channelState.AdvanceCommitChainTail(); err != nil {
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
if err := lc.channelState.AppendToRevocationLog(delta); err != nil {
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3583,13 +3579,8 @@ func (lc *LightningChannel) ReceiveRevocation(revMsg *lnwire.RevokeAndAck) ([]*P
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(roasbeef): re-visit after adding persistence to HTLCs
|
|
||||||
// * either record add height, or set to N - 1
|
|
||||||
uncomitted := (htlc.addCommitHeightRemote == 0 ||
|
uncomitted := (htlc.addCommitHeightRemote == 0 ||
|
||||||
htlc.addCommitHeightLocal == 0)
|
htlc.addCommitHeightLocal == 0)
|
||||||
fmt.Println(remoteChainTail, localChainTail,
|
|
||||||
htlc.addCommitHeightRemote,
|
|
||||||
htlc.addCommitHeightLocal)
|
|
||||||
if htlc.EntryType == Add && uncomitted {
|
if htlc.EntryType == Add && uncomitted {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user