wtxmgr: improve error message for failed tx record retrieval

This commit is contained in:
Wilmer Paulino 2019-10-23 10:45:27 -04:00
parent 7abdd4f8ad
commit 1e2f445cdd
No known key found for this signature in database
GPG key ID: 6DF57B9F9514972F

View file

@ -7,6 +7,7 @@ package wtxmgr
import (
"bytes"
"fmt"
"time"
"github.com/btcsuite/btcd/blockchain"
@ -725,7 +726,8 @@ func (s *Store) UnspentOutputs(ns walletdb.ReadBucket) ([]Credit, error) {
// output amount and pkScript.
rec, err := fetchTxRecord(ns, &op.Hash, &block)
if err != nil {
return err
return fmt.Errorf("unable to retrieve transaction %v: "+
"%v", op.Hash, err)
}
txOut := rec.MsgTx.TxOut[op.Index]
cred := Credit{
@ -768,7 +770,8 @@ func (s *Store) UnspentOutputs(ns walletdb.ReadBucket) ([]Credit, error) {
var rec TxRecord
err = readRawTxRecord(&op.Hash, recVal, &rec)
if err != nil {
return err
return fmt.Errorf("unable to retrieve raw transaction "+
"%v: %v", op.Hash, err)
}
txOut := rec.MsgTx.TxOut[op.Index]