Skip to content

Commit 0c20809

Browse files
committed
Merge #18121: gui: Throttle GUI update pace when -reindex
c9fe612 gui: Throttle GUI update pace when -reindex (Hennadii Stepanov) Pull request description: This is grabbed from #17565. All **laanwj**'s and **ryanofsky**'s suggestions are implemented. With this PR, the GUI does not freeze when a user runs: ``` $ ./src/qt/bitcoin-qt -reindex ``` ACKs for top commit: jonasschnelli: utACK c9fe612 Tree-SHA512: c7be316cb73d3d286bdf8429a960f71777d13a73d059869a64e23ad276499252b561a3a5b9613c4c1ad58cc0de26283c1ec72be745c401f604eaa05f70bf7d64
2 parents b6a16fa + c9fe612 commit 0c20809

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/qt/clientmodel.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,9 @@ static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, int heig
242242
clientmodel->cachedBestHeaderHeight = height;
243243
clientmodel->cachedBestHeaderTime = blockTime;
244244
}
245-
// if we are in-sync or if we notify a header update, update the UI regardless of last update time
246-
if (fHeader || !initialSync || now - nLastUpdateNotification > MODEL_UPDATE_DELAY) {
245+
246+
// During initial sync, block notifications, and header notifications from reindexing are both throttled.
247+
if (!initialSync || (fHeader && !clientmodel->node().getReindex()) || now - nLastUpdateNotification > MODEL_UPDATE_DELAY) {
247248
//pass an async signal to the UI thread
248249
bool invoked = QMetaObject::invokeMethod(clientmodel, "numBlocksChanged", Qt::QueuedConnection,
249250
Q_ARG(int, height),

0 commit comments

Comments
 (0)