netann: add ChanStatusManuallyDisabled state

Add new value for ChanStatus without changing any existing
functionality. The new value indicates that a user manually
requested disabling a channel.
This commit is contained in:
Elliott Jin 2021-02-15 21:56:45 -08:00
parent e9baf0e4a2
commit c40d291488

View File

@ -26,6 +26,18 @@ const (
// ChanStatusDisabled indicates that the channel's last announcement has
// the disabled bit set.
ChanStatusDisabled
// ChanStatusManuallyDisabled indicates that the channel's last
// announcement had the disabled bit set, and that a user manually
// requested disabling the channel. Channels in this state will ignore
// automatic / background attempts to re-enable the channel.
//
// Note that there's no corresponding ChanStatusManuallyEnabled state
// because even if a user manually requests enabling a channel, we still
// DO want to allow automatic / background processes to disable it.
// Otherwise, the network might be cluttered with channels that are
// advertised as enabled, but don't actually work or even exist.
ChanStatusManuallyDisabled
)
// ChannelState describes the ChanStatusManager's view of a channel, and
@ -63,6 +75,14 @@ func (s *channelStates) markDisabled(outpoint wire.OutPoint) {
}
}
// markManuallyDisabled creates a channelState using
// ChanStatusManuallyDisabled.
func (s *channelStates) markManuallyDisabled(outpoint wire.OutPoint) {
(*s)[outpoint] = ChannelState{
Status: ChanStatusManuallyDisabled,
}
}
// markPendingDisabled creates a channelState using ChanStatusPendingDisabled
// and sets the ChannelState's SendDisableTime to sendDisableTime.
func (s *channelStates) markPendingDisabled(outpoint wire.OutPoint,