channeldb: add logging for nodes pruned from the channel graph

This commit is contained in:
Olaoluwa Osuntokun 2018-07-22 21:00:43 -07:00
parent 6bf15e8f2b
commit 8519ea869d
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

View File

@ -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
// any nodes that have a ref count of zero.
var numNodesPruned int
for nodePubKey, refCount := range nodeRefCounts {
// 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
@ -788,7 +789,18 @@ func (c *ChannelGraph) pruneGraphNodes(tx *bolt.Tx, nodes *bolt.Bucket,
if err := c.deleteLightningNode(tx, nodePubKey[:]); err != nil {
log.Warnf("Unable to prune node %x from the "+
"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