mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-29 05:22:30 +02:00
wallet: Avoid recursive lock in CWallet::SetUsedDestinationState
This commit is contained in:
parent
463eab5e14
commit
01f45dd00e
@ -693,13 +693,13 @@ bool CWallet::MarkReplaced(const uint256& originalHash, const uint256& newHash)
|
|||||||
|
|
||||||
void CWallet::SetUsedDestinationState(const uint256& hash, unsigned int n, bool used)
|
void CWallet::SetUsedDestinationState(const uint256& hash, unsigned int n, bool used)
|
||||||
{
|
{
|
||||||
|
AssertLockHeld(cs_wallet);
|
||||||
const CWalletTx* srctx = GetWalletTx(hash);
|
const CWalletTx* srctx = GetWalletTx(hash);
|
||||||
if (!srctx) return;
|
if (!srctx) return;
|
||||||
|
|
||||||
CTxDestination dst;
|
CTxDestination dst;
|
||||||
if (ExtractDestination(srctx->tx->vout[n].scriptPubKey, dst)) {
|
if (ExtractDestination(srctx->tx->vout[n].scriptPubKey, dst)) {
|
||||||
if (IsMine(dst)) {
|
if (IsMine(dst)) {
|
||||||
LOCK(cs_wallet);
|
|
||||||
if (used && !GetDestData(dst, "used", nullptr)) {
|
if (used && !GetDestData(dst, "used", nullptr)) {
|
||||||
AddDestData(dst, "used", "p"); // p for "present", opposite of absent (null)
|
AddDestData(dst, "used", "p"); // p for "present", opposite of absent (null)
|
||||||
} else if (!used && GetDestData(dst, "used", nullptr)) {
|
} else if (!used && GetDestData(dst, "used", nullptr)) {
|
||||||
|
@ -795,7 +795,7 @@ public:
|
|||||||
// Whether this or any UTXO with the same CTxDestination has been spent.
|
// Whether this or any UTXO with the same CTxDestination has been spent.
|
||||||
bool IsUsedDestination(const CTxDestination& dst) const;
|
bool IsUsedDestination(const CTxDestination& dst) const;
|
||||||
bool IsUsedDestination(const uint256& hash, unsigned int n) const;
|
bool IsUsedDestination(const uint256& hash, unsigned int n) const;
|
||||||
void SetUsedDestinationState(const uint256& hash, unsigned int n, bool used);
|
void SetUsedDestinationState(const uint256& hash, unsigned int n, bool used) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||||
|
|
||||||
std::vector<OutputGroup> GroupOutputs(const std::vector<COutput>& outputs, bool single_coin) const;
|
std::vector<OutputGroup> GroupOutputs(const std::vector<COutput>& outputs, bool single_coin) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user