multi: fix fmt.Errorf error wrapping

Refactor fmt.Errorf usage to correctly wrap errors instead of using
non-wrapping format verbs.
This commit is contained in:
ffranr committed 2024-02-27 11:13:40 +00:00
1 parent 581c16d72f
commit cd566eb097
103 files changed
+426 -390

No files matched your search

+1 -1
View File
@@ -143,7 +143,7 @@ func VerifyChannelUpdateSignature(msg *lnwire.ChannelUpdate,
data, err := msg.DataToSign()
if err != nil {
return fmt.Errorf("unable to reconstruct message data: %v", err)
return fmt.Errorf("unable to reconstruct message data: %w", err)
}
dataHash := chainhash.DoubleHashB(data)
+2 -2
View File
@@ -247,7 +247,7 @@ func (c *CfFilteredChainView) FilterBlock(blockHash *chainhash.Hash) (*FilteredB
// outpoint that have been spent.
filter, err := c.p2pNode.GetCFilter(*blockHash, wire.GCSFilterRegular)
if err != nil {
return nil, fmt.Errorf("unable to fetch filter: %v", err)
return nil, fmt.Errorf("unable to fetch filter: %w", err)
}
// Before we can match the filter, we'll need to map each item in our
@@ -349,7 +349,7 @@ func (c *CfFilteredChainView) UpdateFilter(ops []channeldb.EdgePoint,
}
err := c.chainView.Update(rescanUpdate...)
if err != nil {
return fmt.Errorf("unable to update rescan: %v", err)
return fmt.Errorf("unable to update rescan: %w", err)
}
return nil
}
+3 -3
View File
@@ -1057,14 +1057,14 @@ func (r *ChannelRouter) pruneZombieChans() error {
r.cfg.StrictZombiePruning, true, toPrune...,
)
if err != nil {
return fmt.Errorf("unable to delete zombie channels: %v", err)
return fmt.Errorf("unable to delete zombie channels: %w", err)
}
// With the channels pruned, we'll also attempt to prune any nodes that
// were a part of them.
err = r.cfg.Graph.PruneGraphNodes()
if err != nil && err != channeldb.ErrGraphNodesNotFound {
return fmt.Errorf("unable to prune graph nodes: %v", err)
return fmt.Errorf("unable to prune graph nodes: %w", err)
}
return nil
@@ -1612,7 +1612,7 @@ func (r *ChannelRouter) processUpdate(msg interface{},
scid := lnwire.NewShortChanIDFromInt(msg.ChannelID)
if r.cfg.AssumeChannelValid || r.cfg.IsAlias(scid) {
if err := r.cfg.Graph.AddChannelEdge(msg, op...); err != nil {
return fmt.Errorf("unable to add edge: %v", err)
return fmt.Errorf("unable to add edge: %w", err)
}
log.Tracef("New channel discovered! Link "+
"connects %x and %x with ChannelID(%v)",