channeldb: add logging for nodes pruned from the channel graph
This commit is contained in:
1 file changed
+12
@@ -775,6 +775,7 @@ func (c *ChannelGraph) pruneGraphNodes(tx *bolt.Tx, nodes *bolt.Bucket,
|
|||||||
|
|
||||||
// Finally, we'll make a second pass over the set of nodes, and delete
|
// Finally, we'll make a second pass over the set of nodes, and delete
|
||||||
// any nodes that have a ref count of zero.
|
// any nodes that have a ref count of zero.
|
||||||
|
var numNodesPruned int
|
||||||
for nodePubKey, refCount := range nodeRefCounts {
|
for nodePubKey, refCount := range nodeRefCounts {
|
||||||
// If the ref count of the node isn't zero, then we can safely
|
// If the ref count of the node isn't zero, then we can safely
|
||||||
// skip it as it still has edges to or from it within the
|
// skip it as it still has edges to or from it within the
|
||||||
@@ -788,7 +789,18 @@ func (c *ChannelGraph) pruneGraphNodes(tx *bolt.Tx, nodes *bolt.Bucket,
|
|||||||
if err := c.deleteLightningNode(tx, nodePubKey[:]); err != nil {
|
if err := c.deleteLightningNode(tx, nodePubKey[:]); err != nil {
|
||||||
log.Warnf("Unable to prune node %x from the "+
|
log.Warnf("Unable to prune node %x from the "+
|
||||||
"graph: %v", nodePubKey, err)
|
"graph: %v", nodePubKey, err)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Infof("Pruned unconnected node %x from channel graph",
|
||||||
|
nodePubKey[:])
|
||||||
|
|
||||||
|
numNodesPruned++
|
||||||
|
}
|
||||||
|
|
||||||
|
if numNodesPruned > 0 {
|
||||||
|
log.Infof("Pruned %v unconnected nodes from the channel graph",
|
||||||
|
numNodesPruned)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in new issue
Block a user