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.
This commit is contained in:
Keagan McClelland
2024-01-30 20:49:03 -05:00
parent 4e6b1cda49
commit 17e67348a8

View File

@@ -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
}