Check for missing txs before dereferencing details

This commit is contained in:
George Melika 2016-04-06 13:24:46 -07:00 committed by Josh Rickmar
parent d2c851431b
commit eefc610904

View file

@ -1936,6 +1936,10 @@ func (w *Wallet) SignTransaction(tx *wire.MsgTx, hashType txscript.SigHashType,
prevIndex := txIn.PreviousOutPoint.Index prevIndex := txIn.PreviousOutPoint.Index
txDetails, err := w.TxStore.TxDetails(prevHash) txDetails, err := w.TxStore.TxDetails(prevHash)
if err != nil { if err != nil {
return nil, fmt.Errorf("Cannot query previous transaction "+
"details for %v: %v", txIn.PreviousOutPoint, err)
}
if txDetails == nil {
return nil, fmt.Errorf("%v not found", return nil, fmt.Errorf("%v not found",
txIn.PreviousOutPoint) txIn.PreviousOutPoint)
} }