mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-13 12:33:42 +02:00
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:
parent
7180042104
commit
712886a345
1 changed files with 4 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue