diff --git a/graph/db/graph.go b/graph/db/graph.go index 1d53ad3c2..5d9ea819e 100644 --- a/graph/db/graph.go +++ b/graph/db/graph.go @@ -439,3 +439,24 @@ func (c *ChannelGraph) FilterKnownChanIDs(chansInfo []ChannelUpdateInfo, return unknown, nil } + +// MarkEdgeZombie attempts to mark a channel identified by its channel ID as a +// zombie. This method is used on an ad-hoc basis, when channels need to be +// marked as zombies outside the normal pruning cycle. +func (c *ChannelGraph) MarkEdgeZombie(chanID uint64, + pubKey1, pubKey2 [33]byte) error { + + c.cacheMu.Lock() + defer c.cacheMu.Unlock() + + err := c.KVStore.MarkEdgeZombie(chanID, pubKey1, pubKey2) + if err != nil { + return err + } + + if c.graphCache != nil { + c.graphCache.RemoveChannel(pubKey1, pubKey2, chanID) + } + + return nil +} diff --git a/graph/db/kv_store.go b/graph/db/kv_store.go index 04e0d75ae..3dd336578 100644 --- a/graph/db/kv_store.go +++ b/graph/db/kv_store.go @@ -3588,10 +3588,6 @@ func (c *KVStore) MarkEdgeZombie(chanID uint64, "bucket: %w", err) } - if c.graphCache != nil { - c.graphCache.RemoveChannel(pubKey1, pubKey2, chanID) - } - return markEdgeZombie(zombieIndex, chanID, pubKey1, pubKey2) }) if err != nil {