Merge pull request #653 from wpaulino/improve-tx-record-err-msg

wtxmgr: improve error message for failed tx record retrieval
This commit is contained in:
Olaoluwa Osuntokun 2019-11-08 18:05:26 -08:00 committed by GitHub
commit b08b47817c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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