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:
103 files changed
+426
-390
No files matched your search
+4
-4
@@ -72,7 +72,7 @@ func (c *batchChannel) processPendingUpdate(u *lnrpc.OpenStatusUpdate) error {
|
||||
|
||||
hash, err := chainhash.NewHash(pendingUpd.Txid)
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not parse outpoint TX hash: %v", err)
|
||||
return fmt.Errorf("could not parse outpoint TX hash: %w", err)
|
||||
}
|
||||
|
||||
c.chanPoint = &wire.OutPoint{
|
||||
@@ -373,7 +373,7 @@ func (b *Batcher) BatchFund(ctx context.Context,
|
||||
channel.pendingChanID, unsignedPacket, false,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error verifying PSBT: %v", err)
|
||||
return nil, fmt.Errorf("error verifying PSBT: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,7 +391,7 @@ func (b *Batcher) BatchFund(ctx context.Context,
|
||||
finalTx := &wire.MsgTx{}
|
||||
txReader := bytes.NewReader(finalizePsbtResp.RawFinalTx)
|
||||
if err := finalTx.Deserialize(txReader); err != nil {
|
||||
return nil, fmt.Errorf("error parsing signed raw TX: %v", err)
|
||||
return nil, fmt.Errorf("error parsing signed raw TX: %w", err)
|
||||
}
|
||||
log.Tracef("[batchopenchannel] signed PSBT: %s",
|
||||
base64.StdEncoding.EncodeToString(finalizePsbtResp.SignedPsbt))
|
||||
@@ -403,7 +403,7 @@ func (b *Batcher) BatchFund(ctx context.Context,
|
||||
channel.pendingChanID, nil, finalTx,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error finalizing PSBT: %v", err)
|
||||
return nil, fmt.Errorf("error finalizing PSBT: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -1656,7 +1656,7 @@ func (f *Manager) fundeeProcessOpenChannel(peer lnpeer.Peer,
|
||||
if err != nil {
|
||||
f.failFundingFlow(
|
||||
peer, cid,
|
||||
fmt.Errorf("getUpfrontShutdownScript error: %v", err),
|
||||
fmt.Errorf("getUpfrontShutdownScript error: %w", err),
|
||||
)
|
||||
return
|
||||
}
|
||||
@@ -3046,7 +3046,7 @@ func (f *Manager) handleFundingConfirmation(
|
||||
err := f.cfg.Wallet.ValidateChannel(completeChan, confChannel.fundingTx)
|
||||
if err != nil {
|
||||
// TODO(roasbeef): delete chan state?
|
||||
return fmt.Errorf("unable to validate channel: %v", err)
|
||||
return fmt.Errorf("unable to validate channel: %w", err)
|
||||
}
|
||||
|
||||
// Now that the channel has been validated, we'll persist an alias for
|
||||
@@ -3054,14 +3054,14 @@ func (f *Manager) handleFundingConfirmation(
|
||||
if completeChan.NegotiatedAliasFeature() {
|
||||
aliasScid, err := f.cfg.AliasManager.RequestAlias()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to request alias: %v", err)
|
||||
return fmt.Errorf("unable to request alias: %w", err)
|
||||
}
|
||||
|
||||
err = f.cfg.AliasManager.AddLocalAlias(
|
||||
aliasScid, confChannel.shortChanID, true,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to request alias: %v", err)
|
||||
return fmt.Errorf("unable to request alias: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3122,7 +3122,7 @@ func (f *Manager) sendChannelReady(completeChan *channeldb.OpenChannel,
|
||||
// will be unable to propose state transitions.
|
||||
nextRevocation, err := channel.NextRevocationKey()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to create next revocation: %v", err)
|
||||
return fmt.Errorf("unable to create next revocation: %w", err)
|
||||
}
|
||||
channelReadyMsg := lnwire.NewChannelReady(chanID, nextRevocation)
|
||||
|
||||
@@ -3574,7 +3574,7 @@ func (f *Manager) waitForZeroConfChannel(c *channeldb.OpenChannel,
|
||||
// occur due to inconsistency in the OpenChannel struct.
|
||||
err = c.Refresh()
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to refresh channel state: %v", err)
|
||||
return fmt.Errorf("unable to refresh channel state: %w", err)
|
||||
}
|
||||
|
||||
// Now that we have the confirmed transaction and the proper SCID,
|
||||
|
||||
Reference in new issue
Block a user