From b50a94aeab43eac21d90d7364e4a19d01fb39a69 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 9 Nov 2017 23:02:56 -0800 Subject: [PATCH] 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. --- lnwallet/channel.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index da47ee89..5ada25ff 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -3555,13 +3555,9 @@ func (lc *LightningChannel) ReceiveRevocation(revMsg *lnwire.RevokeAndAck) ([]*P // At this point, the revocation has been accepted, and we've rotated // the current revocation key+hash for the remote party. Therefore we // sync now to ensure the revocation producer state is consistent with - // the current commitment height. - tail := lc.remoteCommitChain.tail() - delta, err := tail.toChannelDelta(false) - if err != nil { - return nil, err - } - if err := lc.channelState.AppendToRevocationLog(delta); err != nil { + // the current commitment height and also to advance the on-disk + // commitment chain. + if err := lc.channelState.AdvanceCommitChainTail(); err != nil { return nil, err } @@ -3583,13 +3579,8 @@ func (lc *LightningChannel) ReceiveRevocation(revMsg *lnwire.RevokeAndAck) ([]*P continue } - // TODO(roasbeef): re-visit after adding persistence to HTLCs - // * either record add height, or set to N - 1 uncomitted := (htlc.addCommitHeightRemote == 0 || htlc.addCommitHeightLocal == 0) - fmt.Println(remoteChainTail, localChainTail, - htlc.addCommitHeightRemote, - htlc.addCommitHeightLocal) if htlc.EntryType == Add && uncomitted { continue }