diff --git a/netann/channel_state.go b/netann/channel_state.go index 7f095e60..123a586b 100644 --- a/netann/channel_state.go +++ b/netann/channel_state.go @@ -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,