Skip to content

Commit 9e8d2bd

Browse files
author
MarcoFalke
committed
Merge #97: Relax GUI freezes during IBD (when using wallets)
0d9d2a1 Only update the updateSmartFeeLabel once in sync (Jonas Schnelli) Pull request description: Calling `updateSmartFeeLabel` and therefore `estimateSmartFee` is pointless during IBD. GUI freezes appear because `estimateSmartFee` competes with `processBlock` for the `m_cs_fee_estimator` lock leading to multiple seconds of blocking the GUI thread in `updateSmartFeeLabel`. ACKs for top commit: ryanofsky: Code review ACK 0d9d2a1. Clever fix. Didn't test but I remember I could reproduce the startup issue easily before by putting a sleep in estimateSmartFee. promag: Code review ACK 0d9d2a1. hebasto: ACK 0d9d2a1, tested on Linux Mint 20 (x86_64) with `QT_FATAL_WARNINGS=1` and `-debug=qt`. Tree-SHA512: 85ec2266f06ddd7b523e24d2a462f10ed965d5b4d479005263056f81b7fe49996e1568dafb84658af406e9202ed3bfa846d59c10bb951e0f97cee230e30fafd5
2 parents cb21d86 + 0d9d2a1 commit 9e8d2bd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/qt/sendcoinsdialog.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
#include <wallet/fees.h>
2929
#include <wallet/wallet.h>
3030

31+
#include <validation.h>
32+
3133
#include <QFontMetrics>
3234
#include <QScrollBar>
3335
#include <QSettings>
@@ -134,7 +136,7 @@ void SendCoinsDialog::setClientModel(ClientModel *_clientModel)
134136
this->clientModel = _clientModel;
135137

136138
if (_clientModel) {
137-
connect(_clientModel, &ClientModel::numBlocksChanged, this, &SendCoinsDialog::updateSmartFeeLabel);
139+
connect(_clientModel, &ClientModel::numBlocksChanged, this, &SendCoinsDialog::updateNumberOfBlocks);
138140
}
139141
}
140142

@@ -744,6 +746,12 @@ void SendCoinsDialog::updateCoinControlState(CCoinControl& ctrl)
744746
ctrl.fAllowWatchOnly = model->wallet().privateKeysDisabled();
745747
}
746748

749+
void SendCoinsDialog::updateNumberOfBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers, SynchronizationState sync_state) {
750+
if (sync_state == SynchronizationState::POST_INIT) {
751+
updateSmartFeeLabel();
752+
}
753+
}
754+
747755
void SendCoinsDialog::updateSmartFeeLabel()
748756
{
749757
if(!model || !model->getOptionsModel())

src/qt/sendcoinsdialog.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class ClientModel;
1717
class PlatformStyle;
1818
class SendCoinsEntry;
1919
class SendCoinsRecipient;
20+
enum class SynchronizationState;
2021

2122
namespace Ui {
2223
class SendCoinsDialog;
@@ -98,6 +99,7 @@ private Q_SLOTS:
9899
void coinControlClipboardLowOutput();
99100
void coinControlClipboardChange();
100101
void updateFeeSectionControls();
102+
void updateNumberOfBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool headers, SynchronizationState sync_state);
101103
void updateSmartFeeLabel();
102104

103105
Q_SIGNALS:

0 commit comments

Comments
 (0)