lnwallet: consult current state instead of revocation log during unilateral closure

This commit is contained in:
Olaoluwa Osuntokun 2017-07-30 17:39:19 -07:00
parent db10772bd0
commit 8a23de5303
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -1344,18 +1344,6 @@ func (lc *LightningChannel) closeObserver(channelCloseNtfn *chainntnfs.SpendEven
err) err)
} }
// Once the state has been updated on-disk, we'll fetch all the
// information needed to re-construct the precise state that
// was broadcast.
remoteChanState, err := lc.channelState.FindPreviousState(
broadcastStateNum,
)
if err != nil {
walletLog.Errorf("unable to find prior broadcast "+
"state: %v", err)
return
}
// First, we'll generate the commitment point and the // First, we'll generate the commitment point and the
// revocation point so we can re-construct the HTLC state and // revocation point so we can re-construct the HTLC state and
// also our payment key. // also our payment key.
@ -1365,12 +1353,11 @@ func (lc *LightningChannel) closeObserver(channelCloseNtfn *chainntnfs.SpendEven
commitPoint, commitPoint,
) )
// With the necessary state obtained, we'll obtain HTLC // Next, we'll obtain HTLC resolutions for all the outgoing
// resolutions for all the outgoing HTLC's we had on their // HTLC's we had on their commitment transaction.
// commitment transaction.
htlcResolutions, localKey, err := extractHtlcResolutions( htlcResolutions, localKey, err := extractHtlcResolutions(
remoteChanState.FeePerKw, false, lc.signer, lc.channelState.FeePerKw, false, lc.signer,
remoteChanState.Htlcs, commitPoint, lc.channelState.Htlcs, commitPoint,
revokeKey, lc.localChanCfg, lc.remoteChanCfg, revokeKey, lc.localChanCfg, lc.remoteChanCfg,
*commitSpend.SpenderTxHash) *commitSpend.SpenderTxHash)
if err != nil { if err != nil {