aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfurszy <matiasfurszyfer@protonmail.com>2022-04-27 10:37:50 -0300
committerfurszy <matiasfurszyfer@protonmail.com>2022-06-08 10:26:48 -0300
commit91902b77202fc636edb3db587cb6e87d9fb9b60a (patch)
treedb865522da24521a1cf7453ee8038c7ba0b6a584 /src
parent9472ca0a65396206b3078bddf98f4c1807be2d82 (diff)
wallet: IsLockedCoin, 'COutPoint' arg instead of (hash, index)
Diffstat (limited to 'src')
-rw-r--r--src/wallet/interfaces.cpp2
-rw-r--r--src/wallet/rpc/coins.cpp2
-rw-r--r--src/wallet/spend.cpp2
-rw-r--r--src/wallet/wallet.cpp6
-rw-r--r--src/wallet/wallet.h2
5 files changed, 6 insertions, 8 deletions
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<COutPoint>& 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<COutPoint>& 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);