Merge bitcoin-core/gui#97: Relax GUI freezes during IBD (when using wallets)

0d9d2a1f7c26dc9c7b233ea8c3182fe1f8936bca 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 0d9d2a1f7c26dc9c7b233ea8c3182fe1f8936bca. 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 0d9d2a1f7c26dc9c7b233ea8c3182fe1f8936bca.
  hebasto:
    ACK 0d9d2a1f7c26dc9c7b233ea8c3182fe1f8936bca, tested on Linux Mint 20 (x86_64) with `QT_FATAL_WARNINGS=1` and `-debug=qt`.

Tree-SHA512: 85ec2266f06ddd7b523e24d2a462f10ed965d5b4d479005263056f81b7fe49996e1568dafb84658af406e9202ed3bfa846d59c10bb951e0f97cee230e30fafd5
This commit is contained in:
MarcoFalke 2020-10-16 14:08:24 +02:00 committed by pasta
parent be750ef0b0
commit c5eb8a557a
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984
2 changed files with 11 additions and 1 deletions

View File

@ -28,6 +28,8 @@
#include <wallet/fees.h>
#include <wallet/wallet.h>
#include <validation.h>
#include <QFontMetrics>
#include <QScrollBar>
#include <QSettings>
@ -158,7 +160,7 @@ void SendCoinsDialog::setClientModel(ClientModel *_clientModel)
this->clientModel = _clientModel;
if (_clientModel) {
connect(_clientModel, &ClientModel::numBlocksChanged, this, &SendCoinsDialog::updateSmartFeeLabel);
connect(_clientModel, &ClientModel::numBlocksChanged, this, &SendCoinsDialog::updateNumberOfBlocks);
}
}
@ -838,6 +840,12 @@ void SendCoinsDialog::updateCoinControlState(CCoinControl& ctrl)
ctrl.fAllowWatchOnly = model->wallet().privateKeysDisabled();
}
void SendCoinsDialog::updateNumberOfBlocks(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool header, SynchronizationState sync_state) {
if (sync_state == SynchronizationState::POST_INIT) {
updateSmartFeeLabel();
}
}
void SendCoinsDialog::updateSmartFeeLabel()
{
if(!model || !model->getOptionsModel())

View File

@ -19,6 +19,7 @@ class CCoinControl;
class ClientModel;
class SendCoinsEntry;
class SendCoinsRecipient;
enum class SynchronizationState;
namespace Ui {
class SendCoinsDialog;
@ -101,6 +102,7 @@ private Q_SLOTS:
void coinControlClipboardLowOutput();
void coinControlClipboardChange();
void updateFeeSectionControls();
void updateNumberOfBlocks(int count, const QDateTime& blockDate, const QString& blockHash, double nVerificationProgress, bool header, SynchronizationState sync_state);
void updateSmartFeeLabel();
void keepChangeAddressChanged(bool);