Changeset View
Changeset View
Standalone View
Standalone View
src/qt/clientmodel.cpp
Show First 20 Lines • Show All 215 Lines • ▼ Show 20 Lines | int64_t &nLastUpdateNotification = fHeader | ||||
? nLastHeaderTipUpdateNotification | ? nLastHeaderTipUpdateNotification | ||||
: nLastBlockTipUpdateNotification; | : nLastBlockTipUpdateNotification; | ||||
if (fHeader) { | if (fHeader) { | ||||
// cache best headers time and height to reduce future cs_main locks | // cache best headers time and height to reduce future cs_main locks | ||||
clientmodel->cachedBestHeaderHeight = height; | clientmodel->cachedBestHeaderHeight = height; | ||||
clientmodel->cachedBestHeaderTime = blockTime; | clientmodel->cachedBestHeaderTime = blockTime; | ||||
} | } | ||||
// if we are in-sync, update the UI regardless of last update time | // if we are in-sync or if we notify a header update, update the UI | ||||
if (!initialSync || now - nLastUpdateNotification > MODEL_UPDATE_DELAY) { | // regardless of last update time | ||||
if (fHeader || !initialSync || | |||||
now - nLastUpdateNotification > MODEL_UPDATE_DELAY) { | |||||
// pass an async signal to the UI thread | // pass an async signal to the UI thread | ||||
QMetaObject::invokeMethod( | QMetaObject::invokeMethod( | ||||
clientmodel, "numBlocksChanged", Qt::QueuedConnection, | clientmodel, "numBlocksChanged", Qt::QueuedConnection, | ||||
Q_ARG(int, height), | Q_ARG(int, height), | ||||
Q_ARG(QDateTime, QDateTime::fromTime_t(blockTime)), | Q_ARG(QDateTime, QDateTime::fromTime_t(blockTime)), | ||||
Q_ARG(double, verificationProgress), Q_ARG(bool, fHeader)); | Q_ARG(double, verificationProgress), Q_ARG(bool, fHeader)); | ||||
nLastUpdateNotification = now; | nLastUpdateNotification = now; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |