From 714e42fce2b91bc7b61e4c16ff8c943d50f0d1b1 Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Tue, 12 Mar 2019 17:35:12 -0700 Subject: [PATCH] netann/chan_status_manager: remove unknown edges from passive disable Modifies the netann.ChanStatusManager to remove outpoints from the set of tracked channels when it encounters a channeldb.ErrEdgeNotFound when passively disabling. It is possible for this to occur if a channel is closed w/o first being disabled, which may happen if the remote party force closes. --- netann/chan_status_manager.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/netann/chan_status_manager.go b/netann/chan_status_manager.go index 2d675813..cefa4fe6 100644 --- a/netann/chan_status_manager.go +++ b/netann/chan_status_manager.go @@ -466,6 +466,18 @@ func (m *ChanStatusManager) disableInactiveChannels() { if err != nil { log.Errorf("Unable to sign update disabling "+ "channel(%v): %v", outpoint, err) + + // If the edge was not found, this is a likely indicator + // that the channel has been closed. Thus we remove the + // outpoint from the set of tracked outpoints to prevent + // further attempts. + if err == channeldb.ErrEdgeNotFound { + log.Debugf("Removing channel(%v) from "+ + "consideration for passive disabling", + outpoint) + delete(m.chanStates, outpoint) + } + continue }