mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 22:50:58 +02:00
graph/db: move cache write for MarkEdgeZombie
From the KVStore to the ChannelGraph.
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user