graph/db: move cache write for MarkEdgeZombie
From the KVStore to the ChannelGraph.
This commit is contained in:
2 files changed
+21
-4
No files matched your search
@@ -439,3 +439,24 @@ func (c *ChannelGraph) FilterKnownChanIDs(chansInfo []ChannelUpdateInfo,
|
|||||||
|
|
||||||
return unknown, nil
|
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
|
||||||
|
}
|
||||||
@@ -3588,10 +3588,6 @@ func (c *KVStore) MarkEdgeZombie(chanID uint64,
|
|||||||
"bucket: %w", err)
|
"bucket: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.graphCache != nil {
|
|
||||||
c.graphCache.RemoveChannel(pubKey1, pubKey2, chanID)
|
|
||||||
}
|
|
||||||
|
|
||||||
return markEdgeZombie(zombieIndex, chanID, pubKey1, pubKey2)
|
return markEdgeZombie(zombieIndex, chanID, pubKey1, pubKey2)
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in new issue
Block a user