aboutsummaryrefslogtreecommitdiff
path: root/src/qt/walletmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/walletmodel.cpp')
-rw-r--r--src/qt/walletmodel.cpp30
1 files changed, 20 insertions, 10 deletions
diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp
index 424c9ee279..61f26107af 100644
--- a/src/qt/walletmodel.cpp
+++ b/src/qt/walletmodel.cpp
@@ -98,11 +98,21 @@ void WalletModel::updateStatus()
void WalletModel::pollBalanceChanged()
{
- if(chainActive.Height() != cachedNumBlocks)
+ bool heightChanged = false;
+ {
+ LOCK(cs_main);
+ if(chainActive.Height() != cachedNumBlocks)
+ {
+ // Balance and number of transactions might have changed
+ cachedNumBlocks = chainActive.Height();
+ heightChanged = true;
+ }
+ }
+ if(heightChanged)
{
- // Balance and number of transactions might have changed
- cachedNumBlocks = chainActive.Height();
checkBalanceChanged();
+ if(transactionTableModel)
+ transactionTableModel->updateConfirmations();
}
}
@@ -520,7 +530,7 @@ bool WalletModel::getPubKey(const CKeyID &address, CPubKey& vchPubKeyOut) const
// returns a list of COutputs from COutPoints
void WalletModel::getOutputs(const std::vector<COutPoint>& vOutpoints, std::vector<COutput>& vOutputs)
{
- LOCK(wallet->cs_wallet);
+ LOCK2(cs_main, wallet->cs_wallet);
BOOST_FOREACH(const COutPoint& outpoint, vOutpoints)
{
if (!wallet->mapWallet.count(outpoint.hash)) continue;
@@ -533,7 +543,7 @@ void WalletModel::getOutputs(const std::vector<COutPoint>& vOutpoints, std::vect
bool WalletModel::isSpent(const COutPoint& outpoint) const
{
- LOCK(wallet->cs_wallet);
+ LOCK2(cs_main, wallet->cs_wallet);
return wallet->IsSpent(outpoint.hash, outpoint.n);
}
@@ -543,7 +553,7 @@ void WalletModel::listCoins(std::map<QString, std::vector<COutput> >& mapCoins)
std::vector<COutput> vCoins;
wallet->AvailableCoins(vCoins);
- LOCK(wallet->cs_wallet); // ListLockedCoins, mapWallet
+ LOCK2(cs_main, wallet->cs_wallet); // ListLockedCoins, mapWallet
std::vector<COutPoint> vLockedCoins;
wallet->ListLockedCoins(vLockedCoins);
@@ -575,25 +585,25 @@ void WalletModel::listCoins(std::map<QString, std::vector<COutput> >& mapCoins)
bool WalletModel::isLockedCoin(uint256 hash, unsigned int n) const
{
- LOCK(wallet->cs_wallet);
+ LOCK2(cs_main, wallet->cs_wallet);
return wallet->IsLockedCoin(hash, n);
}
void WalletModel::lockCoin(COutPoint& output)
{
- LOCK(wallet->cs_wallet);
+ LOCK2(cs_main, wallet->cs_wallet);
wallet->LockCoin(output);
}
void WalletModel::unlockCoin(COutPoint& output)
{
- LOCK(wallet->cs_wallet);
+ LOCK2(cs_main, wallet->cs_wallet);
wallet->UnlockCoin(output);
}
void WalletModel::listLockedCoins(std::vector<COutPoint>& vOutpts)
{
- LOCK(wallet->cs_wallet);
+ LOCK2(cs_main, wallet->cs_wallet);
wallet->ListLockedCoins(vOutpts);
}