aboutsummaryrefslogtreecommitdiff
path: root/src/qt/clientmodel.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2015-11-27 13:20:46 +0100
committerJonas Schnelli <dev@jonasschnelli.ch>2015-11-30 08:50:59 +0100
commit947d20b84ab271bec5ff08312921961627d1ad80 (patch)
treee391f64f42f4f5d21c7a87e747dfb961f7531c8a /src/qt/clientmodel.cpp
parente6d50fcdecfdd7281b7aa5e9b573ef1b4e82873f (diff)
[Qt] reduce cs_main in getVerificationProgress()
Diffstat (limited to 'src/qt/clientmodel.cpp')
-rw-r--r--src/qt/clientmodel.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index 92df336c97..f7d8b71748 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -22,6 +22,8 @@
#include <QDebug>
#include <QTimer>
+class CBlockIndex;
+
static const int64_t nClientStartupTime = GetTime();
static int64_t nLastBlockTipUpdateNotification = 0;
@@ -96,10 +98,9 @@ size_t ClientModel::getMempoolDynamicUsage() const
return mempool.DynamicMemoryUsage();
}
-double ClientModel::getVerificationProgress() const
+double ClientModel::getVerificationProgress(const CBlockIndex *tip) const
{
- LOCK(cs_main);
- return Checkpoints::GuessVerificationProgress(Params().Checkpoints(), chainActive.Tip());
+ return Checkpoints::GuessVerificationProgress(Params().Checkpoints(), (CBlockIndex *)tip);
}
void ClientModel::updateTimer()
@@ -246,7 +247,7 @@ static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, const CB
// if we are in-sync, update the UI regardless of last update time
if (!initialSync || now - nLastBlockTipUpdateNotification > MODEL_UPDATE_DELAY) {
//pass a async signal to the UI thread
- Q_EMIT clientmodel->numBlocksChanged(pIndex->nHeight, QDateTime::fromTime_t(pIndex->GetBlockTime()));
+ Q_EMIT clientmodel->numBlocksChanged(pIndex->nHeight, QDateTime::fromTime_t(pIndex->GetBlockTime()), pIndex);
nLastBlockTipUpdateNotification = now;
}