multi: wrap all errors
This commit is contained in:
1 parent
9a28a4c105
commit
648fb22f63
60 files changed
+138
-133
No files matched your search
@@ -792,8 +792,8 @@ func (b *BitcoindNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint,
|
||||
// proceed with fallback methods.
|
||||
jsonErr, ok := err.(*btcjson.RPCError)
|
||||
if !ok || jsonErr.Code != btcjson.ErrRPCNoTxInfo {
|
||||
return nil, fmt.Errorf("unable to query for txid %v: %v",
|
||||
outpoint.Hash, err)
|
||||
return nil, fmt.Errorf("unable to query for txid "+
|
||||
"%v: %w", outpoint.Hash, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -886,8 +886,8 @@ func (b *BtcdNotifier) RegisterSpendNtfn(outpoint *wire.OutPoint,
|
||||
// proceed with fallback methods.
|
||||
jsonErr, ok := err.(*btcjson.RPCError)
|
||||
if !ok || jsonErr.Code != btcjson.ErrRPCNoTxInfo {
|
||||
return nil, fmt.Errorf("unable to query for txid %v: %v",
|
||||
outpoint.Hash, err)
|
||||
return nil, fmt.Errorf("unable to query for txid %v: "+
|
||||
"%w", outpoint.Hash, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-11
@@ -483,13 +483,13 @@ func GetCommonBlockAncestorHeight(chainConn ChainConn, reorgHash,
|
||||
for reorgHash != chainHash {
|
||||
reorgHeader, err := chainConn.GetBlockHeader(&reorgHash)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("unable to get header for hash=%v: %v",
|
||||
reorgHash, err)
|
||||
return 0, fmt.Errorf("unable to get header for "+
|
||||
"hash=%v: %w", reorgHash, err)
|
||||
}
|
||||
chainHeader, err := chainConn.GetBlockHeader(&chainHash)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("unable to get header for hash=%v: %v",
|
||||
chainHash, err)
|
||||
return 0, fmt.Errorf("unable to get header for "+
|
||||
"hash=%v: %w", chainHash, err)
|
||||
}
|
||||
reorgHash = reorgHeader.PrevBlock
|
||||
chainHash = chainHeader.PrevBlock
|
||||
@@ -497,8 +497,8 @@ func GetCommonBlockAncestorHeight(chainConn ChainConn, reorgHash,
|
||||
|
||||
verboseHeader, err := chainConn.GetBlockHeaderVerbose(&chainHash)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("unable to get verbose header for hash=%v: %v",
|
||||
chainHash, err)
|
||||
return 0, fmt.Errorf("unable to get verbose header for "+
|
||||
"hash=%v: %w", chainHash, err)
|
||||
}
|
||||
|
||||
return verboseHeader.Height, nil
|
||||
@@ -719,7 +719,7 @@ func ConfDetailsFromTxIndex(chainConn TxIndexConn, r ConfRequest,
|
||||
}
|
||||
|
||||
return nil, TxNotFoundIndex,
|
||||
fmt.Errorf("unable to query for txid %v: %v",
|
||||
fmt.Errorf("unable to query for txid %v: %w",
|
||||
r.TxID, err)
|
||||
}
|
||||
|
||||
@@ -728,13 +728,13 @@ func ConfDetailsFromTxIndex(chainConn TxIndexConn, r ConfRequest,
|
||||
rawTx, err := hex.DecodeString(rawTxRes.Hex)
|
||||
if err != nil {
|
||||
return nil, TxNotFoundIndex,
|
||||
fmt.Errorf("unable to deserialize tx %v: %v",
|
||||
fmt.Errorf("unable to deserialize tx %v: %w",
|
||||
r.TxID, err)
|
||||
}
|
||||
var tx wire.MsgTx
|
||||
if err := tx.Deserialize(bytes.NewReader(rawTx)); err != nil {
|
||||
return nil, TxNotFoundIndex,
|
||||
fmt.Errorf("unable to deserialize tx %v: %v",
|
||||
fmt.Errorf("unable to deserialize tx %v: %w",
|
||||
r.TxID, err)
|
||||
}
|
||||
|
||||
@@ -759,13 +759,14 @@ func ConfDetailsFromTxIndex(chainConn TxIndexConn, r ConfRequest,
|
||||
if err != nil {
|
||||
return nil, TxNotFoundIndex,
|
||||
fmt.Errorf("unable to get block hash %v for "+
|
||||
"historical dispatch: %v", rawTxRes.BlockHash, err)
|
||||
"historical dispatch: %w", rawTxRes.BlockHash,
|
||||
err)
|
||||
}
|
||||
block, err := chainConn.GetBlock(blockHash)
|
||||
if err != nil {
|
||||
return nil, TxNotFoundIndex,
|
||||
fmt.Errorf("unable to get block with hash %v for "+
|
||||
"historical dispatch: %v", blockHash, err)
|
||||
"historical dispatch: %w", blockHash, err)
|
||||
}
|
||||
|
||||
// In the modern chain (the only one we really care about for LN), the
|
||||
|
||||
@@ -582,8 +582,8 @@ func (n *NeutrinoNotifier) historicalConfDetails(confRequest chainntnfs.ConfRequ
|
||||
// can compute the current block hash.
|
||||
blockHash, err := n.p2pNode.GetBlockHash(int64(scanHeight))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to get header for height=%v: %v",
|
||||
scanHeight, err)
|
||||
return nil, fmt.Errorf("unable to get header for "+
|
||||
"height=%v: %w", scanHeight, err)
|
||||
}
|
||||
|
||||
// With the hash computed, we can now fetch the basic filter for this
|
||||
@@ -600,8 +600,8 @@ func (n *NeutrinoNotifier) historicalConfDetails(confRequest chainntnfs.ConfRequ
|
||||
neutrino.MaxBatchSize(int64(scanHeight-startHeight+1)),
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to retrieve regular filter for "+
|
||||
"height=%v: %v", scanHeight, err)
|
||||
return nil, fmt.Errorf("unable to retrieve regular "+
|
||||
"filter for height=%v: %w", scanHeight, err)
|
||||
}
|
||||
|
||||
// In the case that the filter exists, we'll attempt to see if
|
||||
|
||||
Reference in new issue
Block a user