gui: Throttle GUI update pace when -reindex

Co-authored-by: Barry Deeney <mxaddict@codedmaster.com>
Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
This commit is contained in:
Hennadii Stepanov 2020-02-11 22:34:59 +02:00
parent 98264e2ccb
commit c9fe61291e
No known key found for this signature in database
GPG Key ID: 410108112E7EA81F

View File

@ -242,8 +242,9 @@ static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, int heig
clientmodel->cachedBestHeaderHeight = height;
clientmodel->cachedBestHeaderTime = blockTime;
}
// if we are in-sync or if we notify a header update, update the UI regardless of last update time
if (fHeader || !initialSync || now - nLastUpdateNotification > MODEL_UPDATE_DELAY) {
// During initial sync, block notifications, and header notifications from reindexing are both throttled.
if (!initialSync || (fHeader && !clientmodel->node().getReindex()) || now - nLastUpdateNotification > MODEL_UPDATE_DELAY) {
//pass an async signal to the UI thread
bool invoked = QMetaObject::invokeMethod(clientmodel, "numBlocksChanged", Qt::QueuedConnection,
Q_ARG(int, height),