mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-01 10:43:10 +02: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
|
bool isLockedCoin(const COutPoint& output) override
|
||||||
{
|
{
|
||||||
LOCK(m_wallet->cs_wallet);
|
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
|
void listLockedCoins(std::vector<COutPoint>& outputs) override
|
||||||
{
|
{
|
||||||
|
@ -345,7 +345,7 @@ RPCHelpMan lockunspent()
|
|||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected unspent output");
|
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) {
|
if (fUnlock && !is_locked) {
|
||||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter, expected locked output");
|
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))
|
if (coinControl && coinControl->HasSelected() && !coinControl->fAllowOtherInputs && !coinControl->IsSelected(outpoint))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (wallet.IsLockedCoin(wtxid, i))
|
if (wallet.IsLockedCoin(outpoint))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (wallet.IsSpent(wtxid, i))
|
if (wallet.IsSpent(wtxid, i))
|
||||||
|
@ -2449,12 +2449,10 @@ bool CWallet::UnlockAllCoins()
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWallet::IsLockedCoin(uint256 hash, unsigned int n) const
|
bool CWallet::IsLockedCoin(const COutPoint& output) const
|
||||||
{
|
{
|
||||||
AssertLockHeld(cs_wallet);
|
AssertLockHeld(cs_wallet);
|
||||||
COutPoint outpt(hash, n);
|
return setLockedCoins.count(output) > 0;
|
||||||
|
|
||||||
return (setLockedCoins.count(outpt) > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWallet::ListLockedCoins(std::vector<COutPoint>& vOutpts) const
|
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 */
|
/** 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 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 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 UnlockCoin(const COutPoint& output, WalletBatch* batch = nullptr) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||||
bool UnlockAllCoins() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
bool UnlockAllCoins() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user