diff --git a/src/wallet/interfaces.cpp b/src/wallet/interfaces.cpp index e1203817e0..897c198664 100644 --- a/src/wallet/interfaces.cpp +++ b/src/wallet/interfaces.cpp @@ -245,7 +245,7 @@ public: bool isLockedCoin(const COutPoint& output) override { LOCK(m_wallet->cs_wallet); - return m_wallet->IsLockedCoin(output.hash, output.n); + return m_wallet->IsLockedCoin(output); } void listLockedCoins(std::vector& outputs) override { diff --git a/src/wallet/rpc/coins.cpp b/src/wallet/rpc/coins.cpp index 5efb61c3bd..d9ecbc661e 100644 --- a/src/wallet/rpc/coins.cpp +++ b/src/wallet/rpc/coins.cpp @@ -345,7 +345,7 @@ RPCHelpMan lockunspent() throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected unspent output"); } - const bool is_locked = pwallet->IsLockedCoin(outpt.hash, outpt.n); + const bool is_locked = pwallet->IsLockedCoin(outpt); if (fUnlock && !is_locked) { throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected locked output"); diff --git a/src/wallet/spend.cpp b/src/wallet/spend.cpp index 78d3ad4b88..14edfecdca 100644 --- a/src/wallet/spend.cpp +++ b/src/wallet/spend.cpp @@ -179,7 +179,7 @@ CoinsResult AvailableCoins(const CWallet& wallet, if (coinControl && coinControl->HasSelected() && !coinControl->fAllowOtherInputs && !coinControl->IsSelected(outpoint)) continue; - if (wallet.IsLockedCoin(wtxid, i)) + if (wallet.IsLockedCoin(outpoint)) continue; if (wallet.IsSpent(wtxid, i)) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 6c333c709b..19650ed166 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2449,12 +2449,10 @@ bool CWallet::UnlockAllCoins() return success; } -bool CWallet::IsLockedCoin(uint256 hash, unsigned int n) const +bool CWallet::IsLockedCoin(const COutPoint& output) const { AssertLockHeld(cs_wallet); - COutPoint outpt(hash, n); - - return (setLockedCoins.count(outpt) > 0); + return setLockedCoins.count(output) > 0; } void CWallet::ListLockedCoins(std::vector& vOutpts) const diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 7da601c3b7..bd4a4b2846 100644 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -450,7 +450,7 @@ public: /** Display address on an external signer. Returns false if external signer support is not compiled */ bool DisplayAddress(const CTxDestination& dest) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); - bool IsLockedCoin(uint256 hash, unsigned int n) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); + bool IsLockedCoin(const COutPoint& output) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); bool LockCoin(const COutPoint& output, WalletBatch* batch = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); bool UnlockCoin(const COutPoint& output, WalletBatch* batch = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet); bool UnlockAllCoins() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);