aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGavin Andresen <gavinandresen@gmail.com>2014-03-13 11:43:25 -0400
committerGavin Andresen <gavinandresen@gmail.com>2014-03-13 11:43:25 -0400
commit1e13f57f561dcba493e569bf8fb6507383c62796 (patch)
treebd485dc9bc18389b1592b03458ef29205d2cf42a
parent74502e753b83a79d0bcc4acc21951d6f3132f431 (diff)
parent53d56881a80906bc18cf243deac3e9a721876278 (diff)
Merge pull request #3849 from cozz/cozz2
Fix missing wallet lock in CWallet::SyncTransaction(..)
-rw-r--r--src/wallet.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index 4f7b96e7f2..df1eb549ad 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -589,7 +589,7 @@ bool CWallet::AddToWallet(const CWalletTx& wtxIn, bool fFromLoadWallet)
bool CWallet::AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction& tx, const CBlock* pblock, bool fUpdate)
{
{
- LOCK(cs_wallet);
+ AssertLockHeld(cs_wallet);
bool fExisted = mapWallet.count(hash);
if (fExisted && !fUpdate) return false;
if (fExisted || IsMine(tx) || IsFromMe(tx))
@@ -606,9 +606,8 @@ bool CWallet::AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction&
void CWallet::SyncTransaction(const uint256 &hash, const CTransaction& tx, const CBlock* pblock)
{
- AddToWalletIfInvolvingMe(hash, tx, pblock, true);
-
- if (mapWallet.count(hash) == 0)
+ LOCK(cs_wallet);
+ if (!AddToWalletIfInvolvingMe(hash, tx, pblock, true))
return; // Not one of ours
// If a transaction changes 'conflicted' state, that changes the balance