diff options
author | Jonas Schnelli <dev@jonasschnelli.ch> | 2020-02-13 08:47:56 +0100 |
---|---|---|
committer | Jonas Schnelli <dev@jonasschnelli.ch> | 2020-02-13 08:48:07 +0100 |
commit | 0c20809da85ac708386fa1ca80f7242917f90761 (patch) | |
tree | d838adf64d15ce18a2f39ebd150142fd6a2efcbd | |
parent | b6a16fa44ef27cb597dae7e264a7028352740bd5 (diff) | |
parent | c9fe61291e9b23f37cf66194c2dad28e4d4a8954 (diff) |
Merge #18121: gui: Throttle GUI update pace when -reindex
c9fe61291e9b23f37cf66194c2dad28e4d4a8954 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 c9fe61291e9b23f37cf66194c2dad28e4d4a8954
Tree-SHA512: c7be316cb73d3d286bdf8429a960f71777d13a73d059869a64e23ad276499252b561a3a5b9613c4c1ad58cc0de26283c1ec72be745c401f604eaa05f70bf7d64
-rw-r--r-- | src/qt/clientmodel.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp index e8146982f9..a1ec3eaab1 100644 --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -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), |