From 4c9bd9dc542431429818687c6667e5dfea695616 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 30 Jul 2017 12:50:39 -0700 Subject: [PATCH] lnwallet: when handling possible channel breach, only log if contract breach --- lnwallet/channel.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 1296e0a6..0be2042f 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -1157,12 +1157,6 @@ func (lc *LightningChannel) closeObserver(channelCloseNtfn *chainntnfs.SpendEven } lc.RUnlock() - lc.Lock() - defer lc.Unlock() - - walletLog.Warnf("Unprompted commitment broadcast for ChannelPoint(%v) "+ - "detected!", lc.channelState.ChanID) - // Otherwise, the remote party might have broadcast a prior revoked // state...!!! commitTxBroadcast := commitSpend.SpendingTx @@ -1176,6 +1170,12 @@ func (lc *LightningChannel) closeObserver(channelCloseNtfn *chainntnfs.SpendEven return } + lc.Lock() + defer lc.Unlock() + + walletLog.Warnf("Unprompted commitment broadcast for ChannelPoint(%v) "+ + "detected!", lc.channelState.FundingOutpoint) + // Decode the state hint encoded within the commitment transaction to // determine if this is a revoked state or not. obsfucator := lc.stateHintObsfucator @@ -1203,6 +1203,7 @@ func (lc *LightningChannel) closeObserver(channelCloseNtfn *chainntnfs.SpendEven // As we've detected that the channel has been closed, // immediately delete the state from disk, creating a close // summary for future usage by related sub-systems. + // // TODO(roasbeef): include HTLC's // * and time-locked balance, NEED TO??? closeSummary := channeldb.ChannelCloseSummary{