From 17e67348a8b7dd9389d5cf414feacbee938dcba1 Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Tue, 30 Jan 2024 20:49:03 -0500 Subject: [PATCH] lnwallet: remove unused channelPending channelState lnwallet: remove unused channelPendingPayment channelState Since this state is never set nor read, we remove it completely. lnwallet: remove redundant channelDispute channelState In this case, even though we do set this value, it is never read. Further, the times we read the field at all from LightningChannel we want the situation of force-closure to block any other concurrent closure attempts, so we change the sites where we set channelDispute to channelClosed. lnwallet: remove redundant channelClosing channelStatus This value is never used to impact control flow so we need not set it. We also need not have it. --- lnwallet/channel.go | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/lnwallet/channel.go b/lnwallet/channel.go index 6d7ca722c..1df8c2362 100644 --- a/lnwallet/channel.go +++ b/lnwallet/channel.go @@ -159,30 +159,14 @@ func (e *ErrCommitSyncLocalDataLoss) Error() string { type channelState uint8 const ( - // channelPending indicates this channel is still going through the - // funding workflow, and isn't yet open. - channelPending channelState = iota // nolint: unused - // channelOpen represents an open, active channel capable of // sending/receiving HTLCs. - channelOpen - - // channelClosing represents a channel which is in the process of being - // closed. - channelClosing + channelOpen channelState = iota // channelClosed represents a channel which has been fully closed. Note // that before a channel can be closed, ALL pending HTLCs must be // settled/removed. channelClosed - - // channelDispute indicates that an un-cooperative closure has been - // detected within the channel. - channelDispute - - // channelPendingPayment indicates that there a currently outstanding - // HTLCs within the channel. - channelPendingPayment // nolint:unused ) // PaymentHash represents the sha256 of a random value. This hash is used to @@ -7853,10 +7837,6 @@ func (lc *LightningChannel) CreateCloseProposal(proposedFee btcutil.Amount, } } - // As everything checks out, indicate in the channel status that a - // channel closure has been initiated. - lc.status = channelClosing - closeTXID := closeTx.TxHash() return sig, &closeTXID, ourBalance, nil }