aboutsummaryrefslogtreecommitdiff
path: root/src/qt/clientmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/clientmodel.cpp')
-rw-r--r--src/qt/clientmodel.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp
index a1ec3eaab1..2a69876b6d 100644
--- a/src/qt/clientmodel.cpp
+++ b/src/qt/clientmodel.cpp
@@ -105,6 +105,14 @@ int64_t ClientModel::getHeaderTipTime() const
return cachedBestHeaderTime;
}
+int ClientModel::getNumBlocks() const
+{
+ if (m_cached_num_blocks == -1) {
+ m_cached_num_blocks = m_node.getNumBlocks();
+ }
+ return m_cached_num_blocks;
+}
+
void ClientModel::updateNumConnections(int numConnections)
{
Q_EMIT numConnectionsChanged(numConnections);
@@ -241,6 +249,8 @@ static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, int heig
// cache best headers time and height to reduce future cs_main locks
clientmodel->cachedBestHeaderHeight = height;
clientmodel->cachedBestHeaderTime = blockTime;
+ } else {
+ clientmodel->m_cached_num_blocks = height;
}
// During initial sync, block notifications, and header notifications from reindexing are both throttled.