From 0585ed93be34a17380634142f05e09ab3aac5801 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 27 Dec 2016 15:59:04 -0800 Subject: [PATCH] lnwallet: use in-memory height within channel's closeObserver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit partially rectifies a quick hack that was previously thrown in to address an issue discovered due to possible state inconsistencies between an active channel object and the daemon’s breachAbrbiter. A prior commit has modified the interaction between the peer and the breachArbiter to eliminate the state in consistency. Therefore, we no longer need to access the database to ensure that we’re observing the latest channel state in order to correctly make a decision about whether a broadcast commitment transaction is a breach or not. --- lnwallet/channel.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 46e69cbfc..b7747ff2f 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -703,7 +703,6 @@ func (lc *LightningChannel) closeObserver(channelCloseNtfn *chainntnfs.SpendEven lc.Lock() defer lc.Unlock() - // TODO(roasbeef): logs duplicated due to breachArbiter... walletLog.Warnf("Unprompted commitment broadcast for ChannelPoint(%v) "+ "detected!", lc.channelState.ChanID) @@ -716,11 +715,7 @@ func (lc *LightningChannel) closeObserver(channelCloseNtfn *chainntnfs.SpendEven obsfucator := lc.channelState.StateHintObsfucator broadcastStateNum := uint64(GetStateNumHint(commitTxBroadcast, obsfucator)) - currentStateNum, err := lc.channelState.CommitmentHeight() - if err != nil { - walletLog.Errorf("unable to obtain commitment height: %v", err) - return - } + currentStateNum := lc.currentHeight switch { // If state number spending transaction matches the current latest