mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-02-20 13:34:32 +01:00
channeldb: explicitly catch error in pruneGraphNodes
With the new postgres concurrency control, an error may come from a bucket function that's actually a postgres error. In this case, we need to return early so we can retry the txn. Otherwise, we'll be working with an aborted tx, and never actually return the error so we don't auto retry.
This commit is contained in:
parent
329fcc6498
commit
120d6dd297
1 changed files with 9 additions and 3 deletions
|
@ -1508,9 +1508,15 @@ func (c *ChannelGraph) pruneGraphNodes(nodes kvdb.RwBucket,
|
|||
// If we reach this point, then there are no longer any edges
|
||||
// that connect this node, so we can delete it.
|
||||
if err := c.deleteLightningNode(nodes, nodePubKey[:]); err != nil {
|
||||
log.Warnf("Unable to prune node %x from the "+
|
||||
"graph: %v", nodePubKey, err)
|
||||
continue
|
||||
if errors.Is(err, ErrGraphNodeNotFound) ||
|
||||
errors.Is(err, ErrGraphNodesNotFound) {
|
||||
|
||||
log.Warnf("Unable to prune node %x from the "+
|
||||
"graph: %v", nodePubKey, err)
|
||||
continue
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
log.Infof("Pruned unconnected node %x from channel graph",
|
||||
|
|
Loading…
Add table
Reference in a new issue