diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index f983b03414..cf72455a9d 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3133,7 +3133,7 @@ static UniValue listunspent(const JSONRPCRequest& request) CTxDestination address; const CScript& scriptPubKey = out.tx->tx->vout[out.i].scriptPubKey; bool fValidAddress = ExtractDestination(scriptPubKey, address); - bool reused = avoid_reuse && pwallet->IsUsedDestination(address); + bool reused = avoid_reuse && pwallet->IsSpentKey(address); if (destinations.size() && (!fValidAddress || !destinations.count(address))) continue; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 22168a110d..93b8460a01 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -777,7 +777,7 @@ void CWallet::MarkDirty() fAnonymizableTallyCachedNonDenom = false; } -void CWallet::SetUsedDestinationState(const uint256& hash, unsigned int n, bool used, std::set& tx_destinations) +void CWallet::SetSpentKeyState(const uint256& hash, unsigned int n, bool used, std::set& tx_destinations) { const CWalletTx* srctx = GetWalletTx(hash); if (!srctx) return; @@ -797,17 +797,17 @@ void CWallet::SetUsedDestinationState(const uint256& hash, unsigned int n, bool } } -bool CWallet::IsUsedDestination(const CTxDestination& dst) const +bool CWallet::IsSpentKey(const CTxDestination& dst) const { LOCK(cs_wallet); return IsMine(dst) && GetDestData(dst, "used", nullptr); } -bool CWallet::IsUsedDestination(const uint256& hash, unsigned int n) const +bool CWallet::IsSpentKey(const uint256& hash, unsigned int n) const { CTxDestination dst; const CWalletTx* srctx = GetWalletTx(hash); - return srctx && ExtractDestination(srctx->tx->vout[n].scriptPubKey, dst) && IsUsedDestination(dst); + return srctx && ExtractDestination(srctx->tx->vout[n].scriptPubKey, dst) && IsSpentKey(dst); } bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose) @@ -824,7 +824,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFlushOnClose) for (const CTxIn& txin : wtxIn.tx->vin) { const COutPoint& op = txin.prevout; - SetUsedDestinationState(op.hash, op.n, true, tx_destinations); + SetSpentKeyState(op.hash, op.n, true, tx_destinations); } MarkDestinationsDirty(tx_destinations); @@ -2102,7 +2102,7 @@ CAmount CWalletTx::GetAvailableCredit(bool fUseCache, const isminefilter& filter uint256 hashTx = GetHash(); for (unsigned int i = 0; i < tx->vout.size(); i++) { - if (!pwallet->IsSpent(hashTx, i) && (allow_used_addresses || !pwallet->IsUsedDestination(hashTx, i))) + if (!pwallet->IsSpent(hashTx, i) && (allow_used_addresses || !pwallet->IsSpentKey(hashTx, i))) { const CTxOut &txout = tx->vout[i]; nCredit += pwallet->GetCredit(txout, filter); @@ -2546,7 +2546,7 @@ void CWallet::AvailableCoins(std::vector &vCoins, bool fOnlySafe, const continue; } - if (!allow_used_addresses && IsUsedDestination(wtxid, i)) { + if (!allow_used_addresses && IsSpentKey(wtxid, i)) { continue; } diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index c525da8a83..5f3dfbc75c 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -907,9 +907,9 @@ public: bool IsSpent(const uint256& hash, unsigned int n) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); // Whether this or any UTXO with the same CTxDestination has been spent. - bool IsUsedDestination(const CTxDestination& dst) const; - bool IsUsedDestination(const uint256& hash, unsigned int n) const; - void SetUsedDestinationState(const uint256& hash, unsigned int n, bool used, std::set& tx_destinations); + bool IsSpentKey(const CTxDestination& dst) const; + bool IsSpentKey(const uint256& hash, unsigned int n) const; + void SetSpentKeyState(const uint256& hash, unsigned int n, bool used, std::set& tx_destinations); std::vector GroupOutputs(const std::vector& outputs, bool single_coin) const;