Skip to content

Commit 1e13f57

Browse files
committed
Merge pull request #3849 from cozz/cozz2
Fix missing wallet lock in CWallet::SyncTransaction(..)
2 parents 74502e7 + 53d5688 commit 1e13f57

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/wallet.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet)
589589
bool CWallet::AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate)
590590
{
591591
{
592-
LOCK(cs_wallet);
592+
AssertLockHeld(cs_wallet);
593593
bool fExisted = mapWallet.count(hash);
594594
if (fExisted && !fUpdate) return false;
595595
if (fExisted || IsMine(tx) || IsFromMe(tx))
@@ -606,9 +606,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction&
606606

607607
void CWallet::SyncTransaction(const uint256 &hash, const CTransaction& tx, const CBlock* pblock)
608608
{
609-
AddToWalletIfInvolvingMe(hash, tx, pblock, true);
610-
611-
if (mapWallet.count(hash) == 0)
609+
LOCK(cs_wallet);
610+
if (!AddToWalletIfInvolvingMe(hash, tx, pblock, true))
612611
return; // Not one of ours
613612

614613
// If a transaction changes 'conflicted' state, that changes the balance

0 commit comments

Comments
 (0)