aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-04-15 17:38:25 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2014-04-18 12:49:41 +0200
commit55a1db4fa2cf62b9766ef382c1e14b3ecbdf67fe (patch)
tree1ff19f533ab0221e27dd16c3d401c4d54dfbca7b /src/wallet.cpp
parente07c943ce8df6c6cb3ece3fc676911ddb43ca184 (diff)
downloadbitcoin-55a1db4fa2cf62b9766ef382c1e14b3ecbdf67fe.tar.xz
Solve chainActive-related locking issues
- In wallet and GUI code LOCK cs_main as well as cs_wallet when necessary - In main.cpp SendMessages move the TRY_LOCK(cs_main) up, to encompass the call to IsInitialBlockDownload. - Make ActivateBestChain, AddToBlockIndex, IsInitialBlockDownload, InitBlockIndex acquire the cs_main lock Fixes #3997
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r--src/wallet.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index 775eb8f580..6b0c604a34 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -606,7 +606,7 @@ bool CWallet::AddToWalletIfInvolvingMe(const uint256 &hash, const CTransaction&
void CWallet::SyncTransaction(const uint256 &hash, const CTransaction& tx, const CBlock* pblock)
{
- LOCK(cs_wallet);
+ LOCK2(cs_main, cs_wallet);
if (!AddToWalletIfInvolvingMe(hash, tx, pblock, true))
return; // Not one of ours
@@ -834,7 +834,7 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
CBlockIndex* pindex = pindexStart;
{
- LOCK(cs_wallet);
+ LOCK2(cs_main, cs_wallet);
// no need to read and scan block, if block was created before
// our wallet birthday (as adjusted for block time variability)
@@ -869,7 +869,7 @@ int CWallet::ScanForWalletTransactions(CBlockIndex* pindexStart, bool fUpdate)
void CWallet::ReacceptWalletTransactions()
{
- LOCK(cs_wallet);
+ LOCK2(cs_main, cs_wallet);
BOOST_FOREACH(PAIRTYPE(const uint256, CWalletTx)& item, mapWallet)
{
const uint256& wtxid = item.first;
@@ -964,7 +964,7 @@ int64_t CWallet::GetBalance() const
{
int64_t nTotal = 0;
{
- LOCK(cs_wallet);
+ LOCK2(cs_main, cs_wallet);
for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
{
const CWalletTx* pcoin = &(*it).second;
@@ -980,7 +980,7 @@ int64_t CWallet::GetUnconfirmedBalance() const
{
int64_t nTotal = 0;
{
- LOCK(cs_wallet);
+ LOCK2(cs_main, cs_wallet);
for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
{
const CWalletTx* pcoin = &(*it).second;
@@ -995,7 +995,7 @@ int64_t CWallet::GetImmatureBalance() const
{
int64_t nTotal = 0;
{
- LOCK(cs_wallet);
+ LOCK2(cs_main, cs_wallet);
for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
{
const CWalletTx* pcoin = &(*it).second;