aboutsummaryrefslogtreecommitdiff
path: root/src/qt/clientmodel.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <dev@jonasschnelli.ch>2015-11-27 18:22:18 +0100
committerJonas Schnelli <dev@jonasschnelli.ch>2015-11-30 08:53:57 +0100
commit4082e4660305f7696949c3a13e2e9611210894e8 (patch)
tree0c9cf30842663b53cbe95300688b0a9f29d9a985 /src/qt/clientmodel.cpp
parent947d20b84ab271bec5ff08312921961627d1ad80 (diff)
[Qt] call GuessVerificationProgress synchronous during core signal, pass double over UI signal
Diffstat (limited to 'src/qt/clientmodel.cpp')
-rw-r--r--src/qt/clientmodel.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index f7d8b71748..d36d129c1a 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -98,9 +98,15 @@ size_t ClientModel::getMempoolDynamicUsage() const
return mempool.DynamicMemoryUsage();
}
-double ClientModel::getVerificationProgress(const CBlockIndex *tip) const
+double ClientModel::getVerificationProgress(const CBlockIndex *tipIn) const
{
- return Checkpoints::GuessVerificationProgress(Params().Checkpoints(), (CBlockIndex *)tip);
+ CBlockIndex *tip = const_cast<CBlockIndex *>(tipIn);
+ if (!tip)
+ {
+ LOCK(cs_main);
+ tip = chainActive.Tip();
+ }
+ return Checkpoints::GuessVerificationProgress(Params().Checkpoints(), tip);
}
void ClientModel::updateTimer()
@@ -247,10 +253,9 @@ 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()), pIndex);
+ Q_EMIT clientmodel->numBlocksChanged(pIndex->nHeight, QDateTime::fromTime_t(pIndex->GetBlockTime()), clientmodel->getVerificationProgress(pIndex));
nLastBlockTipUpdateNotification = now;
}
-
}
void ClientModel::subscribeToCoreSignals()