Skip to content

Commit 51ea44f

Browse files
committed
Use "return false" instead assert() in CWallet::SignTransaction
1 parent bcc72cc commit 51ea44f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/wallet/wallet.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2263,7 +2263,9 @@ bool CWallet::SignTransaction(CMutableTransaction &tx)
22632263
int nIn = 0;
22642264
for (auto& input : tx.vin) {
22652265
std::map<uint256, CWalletTx>::const_iterator mi = mapWallet.find(input.prevout.hash);
2266-
assert(mi != mapWallet.end() && input.prevout.n < mi->second.tx->vout.size());
2266+
if(mi == mapWallet.end() || input.prevout.n >= mi->second.tx->vout.size()) {
2267+
return false;
2268+
}
22672269
const CScript& scriptPubKey = mi->second.tx->vout[input.prevout.n].scriptPubKey;
22682270
const CAmount& amount = mi->second.tx->vout[input.prevout.n].nValue;
22692271
SignatureData sigdata;

0 commit comments

Comments
 (0)