Browse Source

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.
master
Elliott Jin 3 years ago
parent
commit
c40d291488
  1. 20
      netann/channel_state.go

20
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,

Loading…
Cancel
Save