From 947d20b84ab271bec5ff08312921961627d1ad80 Mon Sep 17 00:00:00 2001 From: Jonas Schnelli Date: Fri, 27 Nov 2015 13:20:46 +0100 Subject: [Qt] reduce cs_main in getVerificationProgress() --- src/qt/clientmodel.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/qt/clientmodel.cpp') 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 #include +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; } -- cgit v1.2.3