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
2024-02-26 11:19:38 +00:00
parent 581c16d72f
commit cd566eb097
103 changed files with 426 additions and 390 deletions

View File

@@ -692,7 +692,7 @@ func (b *BtcdNotifier) handleBlockConnected(epoch chainntnfs.BlockEpoch) error {
// clients.
rawBlock, err := b.GetBlock(epoch.Hash)
if err != nil {
return fmt.Errorf("unable to get block: %v", err)
return fmt.Errorf("unable to get block: %w", err)
}
newBlock := &filteredBlock{
hash: *epoch.Hash,
@@ -706,7 +706,7 @@ func (b *BtcdNotifier) handleBlockConnected(epoch chainntnfs.BlockEpoch) error {
// us.
err = b.txNotifier.ConnectTip(newBlock.block, newBlock.height)
if err != nil {
return fmt.Errorf("unable to connect tip: %v", err)
return fmt.Errorf("unable to connect tip: %w", err)
}
chainntnfs.Log.Infof("New block: height=%v, sha=%v", epoch.Height,
@@ -785,7 +785,8 @@ func (b *BtcdNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint,
pkScript, b.chainParams,
)
if err != nil {
return nil, fmt.Errorf("unable to parse script: %v", err)
return nil, fmt.Errorf("unable to parse script: %w",
err)
}
if err := b.chainConn.NotifyReceived(addrs); err != nil {
return nil, err
@@ -823,7 +824,8 @@ func (b *BtcdNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint,
pkScript, b.chainParams,
)
if err != nil {
return nil, fmt.Errorf("unable to parse address: %v", err)
return nil, fmt.Errorf("unable to parse address: %w",
err)
}
asyncResult := b.chainConn.RescanAsync(startHash, addrs, nil)