@@ -153,22 +153,6 @@ func (e *ErrCommitSyncLocalDataLoss) Error() string {
153
153
e .CommitPoint .SerializeCompressed ())
154
154
}
155
155
156
- // channelState is an enum like type which represents the current state of a
157
- // particular channel.
158
- // TODO(roasbeef): actually update state
159
- type channelState uint8
160
-
161
- const (
162
- // channelOpen represents an open, active channel capable of
163
- // sending/receiving HTLCs.
164
- channelOpen channelState = iota
165
-
166
- // channelClosed represents a channel which has been fully closed. Note
167
- // that before a channel can be closed, ALL pending HTLCs must be
168
- // settled/removed.
169
- channelClosed
170
- )
171
-
172
156
// PaymentHash represents the sha256 of a random value. This hash is used to
173
157
// uniquely track incoming/outgoing payments within this channel, as well as
174
158
// payments requested by the wallet/daemon.
@@ -1267,7 +1251,7 @@ type LightningChannel struct {
1267
1251
// the commitment transaction that spends the multi-sig output.
1268
1252
signDesc * input.SignDescriptor
1269
1253
1270
- status channelState
1254
+ isClosed bool
1271
1255
1272
1256
// ChanPoint is the funding outpoint of this channel.
1273
1257
ChanPoint * wire.OutPoint
@@ -1522,7 +1506,7 @@ func (lc *LightningChannel) createSignDesc() error {
1522
1506
// events do so properly.
1523
1507
func (lc * LightningChannel ) ResetState () {
1524
1508
lc .Lock ()
1525
- lc .status = channelOpen
1509
+ lc .isClosed = false
1526
1510
lc .Unlock ()
1527
1511
}
1528
1512
@@ -7577,9 +7561,8 @@ func (lc *LightningChannel) ForceClose() (*LocalForceCloseSummary, error) {
7577
7561
"summary: %w" , err )
7578
7562
}
7579
7563
7580
- // Set the channel state to indicate that the channel is now in a
7581
- // contested state.
7582
- lc .status = channelClosed
7564
+ // Mark the channel as closed to block future closure requests.
7565
+ lc .isClosed = true
7583
7566
7584
7567
return summary , nil
7585
7568
}
@@ -7773,8 +7756,8 @@ func (lc *LightningChannel) CreateCloseProposal(proposedFee btcutil.Amount,
7773
7756
lc .Lock ()
7774
7757
defer lc .Unlock ()
7775
7758
7776
- // If we've already closed the channel, then ignore this request.
7777
- if lc .status == channelClosed {
7759
+ // If we're already closing the channel, then ignore this request.
7760
+ if lc .isClosed {
7778
7761
// TODO(roasbeef): check to ensure no pending payments
7779
7762
return nil , nil , 0 , ErrChanClosing
7780
7763
}
@@ -7857,8 +7840,8 @@ func (lc *LightningChannel) CompleteCooperativeClose(
7857
7840
lc .Lock ()
7858
7841
defer lc .Unlock ()
7859
7842
7860
- // If the channel is already closed , then ignore this request.
7861
- if lc .status == channelClosed {
7843
+ // If the channel is already closing , then ignore this request.
7844
+ if lc .isClosed {
7862
7845
// TODO(roasbeef): check to ensure no pending payments
7863
7846
return nil , 0 , ErrChanClosing
7864
7847
}
@@ -7962,7 +7945,7 @@ func (lc *LightningChannel) CompleteCooperativeClose(
7962
7945
// As the transaction is sane, and the scripts are valid we'll mark the
7963
7946
// channel now as closed as the closure transaction should get into the
7964
7947
// chain in a timely manner and possibly be re-broadcast by the wallet.
7965
- lc .status = channelClosed
7948
+ lc .isClosed = true
7966
7949
7967
7950
return closeTx , ourBalance , nil
7968
7951
}
0 commit comments