Skip to content

Commit 91902b7

Browse files
committed
wallet: IsLockedCoin, 'COutPoint' arg instead of (hash, index)
1 parent 9472ca0 commit 91902b7

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

src/wallet/interfaces.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ class WalletImpl : public Wallet
245245
bool isLockedCoin(const COutPoint& output) override
246246
{
247247
LOCK(m_wallet->cs_wallet);
248-
return m_wallet->IsLockedCoin(output.hash, output.n);
248+
return m_wallet->IsLockedCoin(output);
249249
}
250250
void listLockedCoins(std::vector<COutPoint>& outputs) override
251251
{

src/wallet/rpc/coins.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ RPCHelpMan lockunspent()
345345
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected unspent output");
346346
}
347347

348-
const bool is_locked = pwallet->IsLockedCoin(outpt.hash, outpt.n);
348+
const bool is_locked = pwallet->IsLockedCoin(outpt);
349349

350350
if (fUnlock && !is_locked) {
351351
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected locked output");

src/wallet/spend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ CoinsResult AvailableCoins(const CWallet& wallet,
179179
if (coinControl && coinControl->HasSelected() && !coinControl->fAllowOtherInputs && !coinControl->IsSelected(outpoint))
180180
continue;
181181

182-
if (wallet.IsLockedCoin(wtxid, i))
182+
if (wallet.IsLockedCoin(outpoint))
183183
continue;
184184

185185
if (wallet.IsSpent(wtxid, i))

src/wallet/wallet.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,12 +2449,10 @@ bool CWallet::UnlockAllCoins()
24492449
return success;
24502450
}
24512451

2452-
bool CWallet::IsLockedCoin(uint256 hash, unsigned int n) const
2452+
bool CWallet::IsLockedCoin(const COutPoint& output) const
24532453
{
24542454
AssertLockHeld(cs_wallet);
2455-
COutPoint outpt(hash, n);
2456-
2457-
return (setLockedCoins.count(outpt) > 0);
2455+
return setLockedCoins.count(output) > 0;
24582456
}
24592457

24602458
void CWallet::ListLockedCoins(std::vector<COutPoint>& vOutpts) const

src/wallet/wallet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
450450
/** Display address on an external signer. Returns false if external signer support is not compiled */
451451
bool DisplayAddress(const CTxDestination& dest) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
452452

453-
bool IsLockedCoin(uint256 hash, unsigned int n) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
453+
bool IsLockedCoin(const COutPoint& output) const EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
454454
bool LockCoin(const COutPoint& output, WalletBatch* batch = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
455455
bool UnlockCoin(const COutPoint& output, WalletBatch* batch = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
456456
bool UnlockAllCoins() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);

0 commit comments

Comments
 (0)