mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-05-31 02:01:46 +02:00
graph/db: handle previously-unhandled errors
This commit is contained in:
parent
c29fb81d1b
commit
c01dcc2be7
@ -1127,7 +1127,7 @@ func (c *ChannelGraph) addChannelEdge(tx kvdb.RwTx,
|
||||
err := addLightningNode(tx, &node1Shell)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to create shell node "+
|
||||
"for: %x", edge.NodeKey1Bytes)
|
||||
"for: %x: %w", edge.NodeKey1Bytes, err)
|
||||
}
|
||||
case node1Err != nil:
|
||||
return err
|
||||
@ -1143,7 +1143,7 @@ func (c *ChannelGraph) addChannelEdge(tx kvdb.RwTx,
|
||||
err := addLightningNode(tx, &node2Shell)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to create shell node "+
|
||||
"for: %x", edge.NodeKey2Bytes)
|
||||
"for: %x: %w", edge.NodeKey2Bytes, err)
|
||||
}
|
||||
case node2Err != nil:
|
||||
return err
|
||||
@ -2692,8 +2692,14 @@ func (c *ChannelGraph) delChannelEdgeUnsafe(edges, edgeIndex, chanIndex,
|
||||
// As part of deleting the edge we also remove all disabled entries
|
||||
// from the edgePolicyDisabledIndex bucket. We do that for both
|
||||
// directions.
|
||||
updateEdgePolicyDisabledIndex(edges, cid, false, false)
|
||||
updateEdgePolicyDisabledIndex(edges, cid, true, false)
|
||||
err = updateEdgePolicyDisabledIndex(edges, cid, false, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = updateEdgePolicyDisabledIndex(edges, cid, true, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// With the edge data deleted, we can purge the information from the two
|
||||
// edge indexes.
|
||||
@ -4410,11 +4416,14 @@ func putChanEdgePolicy(edges kvdb.RwBucket, edge *models.ChannelEdgePolicy,
|
||||
return err
|
||||
}
|
||||
|
||||
updateEdgePolicyDisabledIndex(
|
||||
err = updateEdgePolicyDisabledIndex(
|
||||
edges, edge.ChannelID,
|
||||
edge.ChannelFlags&lnwire.ChanUpdateDirection > 0,
|
||||
edge.IsDisabled(),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return edges.Put(edgeKey[:], b.Bytes()[:])
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user