aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/receive.cpp
diff options
context:
space:
mode:
authorfurszy <matiasfurszyfer@protonmail.com>2022-04-27 11:04:31 -0300
committerfurszy <matiasfurszyfer@protonmail.com>2022-06-08 11:22:40 -0300
commit4b83bf8dbcf6b8b1c1293575391e90ac7e21b0e0 (patch)
tree4ac5a5f92709ae76159429c885834570527eecb0 /src/wallet/receive.cpp
parent3d8a2822570e3cf4d1bc4f9d59b5dcb0145920ad (diff)
wallet: avoid extra IsSpentKey -> GetWalletTx lookups
Diffstat (limited to 'src/wallet/receive.cpp')
-rw-r--r--src/wallet/receive.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wallet/receive.cpp b/src/wallet/receive.cpp
index 39d4574def..8de4017371 100644
--- a/src/wallet/receive.cpp
+++ b/src/wallet/receive.cpp
@@ -205,8 +205,8 @@ CAmount CachedTxGetAvailableCredit(const CWallet& wallet, const CWalletTx& wtx,
CAmount nCredit = 0;
uint256 hashTx = wtx.GetHash();
for (unsigned int i = 0; i < wtx.tx->vout.size(); i++) {
- if (!wallet.IsSpent(COutPoint(hashTx, i)) && (allow_used_addresses || !wallet.IsSpentKey(hashTx, i))) {
- const CTxOut &txout = wtx.tx->vout[i];
+ const CTxOut& txout = wtx.tx->vout[i];
+ if (!wallet.IsSpent(COutPoint(hashTx, i)) && (allow_used_addresses || !wallet.IsSpentKey(txout.scriptPubKey))) {
nCredit += OutputGetCredit(wallet, txout, filter);
if (!MoneyRange(nCredit))
throw std::runtime_error(std::string(__func__) + " : value out of range");