mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
wallet: IsLockedCoin, 'COutPoint' arg instead of (hash, index)
This commit is contained in:
parent
9472ca0a65
commit
91902b7720
@ -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
|
||||
{
|
||||
|
@ -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");
|
||||
|
@ -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))
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user