graph/db: move cache write for MarkEdgeZombie

From the KVStore to the ChannelGraph.
This commit is contained in:
Elle Mouton
2025-02-25 11:31:03 +02:00
parent 4d00eb2aa4
commit 9d0b9f9ace
2 changed files with 21 additions and 4 deletions

View File

@@ -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
}