Fixed errors after receiving a tx with wrong scanning key

After someone sent a transaction using a wrong scanning key to an alphad
wallet, "CWallet::GetCredit() : value out of range" errors were returned
on attempts to get balance or create new outgoing transactions. This change
causes such outputs to be ignored, thus preventing wallet from being locked
down this way.
This commit is contained in:
Jerzy Kozera 2015-12-16 19:51:54 +01:00
parent 7180042104
commit 712886a345

View file

@ -737,6 +737,10 @@ public:
CAmount amount = 0;
if (pwallet->IsMine(vout[nTxOut]) & filter)
amount = GetValueOut(nTxOut);
// Can be -1 if someone sent us a transaction using a wrong scanning key:
if (amount == -1) {
return 0;
}
if (!MoneyRange(amount))
throw std::runtime_error("CWallet::GetCredit() : value out of range");
return amount;