channeldb/graph: remove MarkEdgeZombie
This commit removes the MarkEdgeZombie method from channeldb. This method is currently not used in any live code paths in production, and is only used in unit tests. However, incorrect usage of this method could result in an edge being present in both the zombie and channel indexes, which deviates from any state we would expect to see in production. Removing the method will help mitigate the potential for writing incorrect unit tests in the future, by forcing zombie edges to be created via the relevant, production APIs, e.g. DeleteChannelEdge. The existing unit tests that use this method have been modified to use the DeleteChannelEdge instead. No regressions were discovered in the process.
This commit is contained in:
2 files changed
+18
-41
No files matched your search
@@ -3065,36 +3065,6 @@ func (c *ChannelGraph) NewChannelEdgePolicy() *ChannelEdgePolicy {
|
||||
return &ChannelEdgePolicy{db: c.db}
|
||||
}
|
||||
|
||||
// MarkEdgeZombie marks an edge as a zombie within the graph's zombie index.
|
||||
// The public keys should represent the node public keys of the two parties
|
||||
// involved in the edge.
|
||||
func (c *ChannelGraph) MarkEdgeZombie(chanID uint64, pubKey1,
|
||||
pubKey2 [33]byte) error {
|
||||
|
||||
c.cacheMu.Lock()
|
||||
defer c.cacheMu.Unlock()
|
||||
|
||||
err := c.db.Update(func(tx *bbolt.Tx) error {
|
||||
edges := tx.Bucket(edgeBucket)
|
||||
if edges == nil {
|
||||
return ErrGraphNoEdgesFound
|
||||
}
|
||||
zombieIndex, err := edges.CreateBucketIfNotExists(zombieBucket)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return markEdgeZombie(zombieIndex, chanID, pubKey1, pubKey2)
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c.rejectCache.remove(chanID)
|
||||
c.chanCache.remove(chanID)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// markEdgeZombie marks an edge as a zombie within our zombie index. The public
|
||||
// keys should represent the node public keys of the two parties involved in the
|
||||
// edge.
|
||||
|
||||
Reference in new issue
Block a user