mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-24 22:45:41 +01:00
gui: Avoid redundant tx status updates
In TransactionTablePriv::index, avoid calling interfaces::Wallet::tryGetTxStatus if the status is up to date as of the most recent NotifyBlockTip notification. Store height from the most recent notification in a new ClientModel::cachedNumBlocks variable in order to check this. This avoids floods of IPC traffic from tryGetTxStatus with #10102 when there are a lot of transactions. It might also make the GUI a little more efficient even when there is no IPC.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <qt/walletcontroller.h>
|
||||
|
||||
#include <qt/askpassphrasedialog.h>
|
||||
#include <qt/clientmodel.h>
|
||||
#include <qt/createwalletdialog.h>
|
||||
#include <qt/guiconstants.h>
|
||||
#include <qt/guiutil.h>
|
||||
@@ -24,13 +25,14 @@
|
||||
#include <QTimer>
|
||||
#include <QWindow>
|
||||
|
||||
WalletController::WalletController(interfaces::Node& node, const PlatformStyle* platform_style, OptionsModel* options_model, QObject* parent)
|
||||
WalletController::WalletController(ClientModel& client_model, const PlatformStyle* platform_style, QObject* parent)
|
||||
: QObject(parent)
|
||||
, m_activity_thread(new QThread(this))
|
||||
, m_activity_worker(new QObject)
|
||||
, m_node(node)
|
||||
, m_client_model(client_model)
|
||||
, m_node(client_model.node())
|
||||
, m_platform_style(platform_style)
|
||||
, m_options_model(options_model)
|
||||
, m_options_model(client_model.getOptionsModel())
|
||||
{
|
||||
m_handler_load_wallet = m_node.handleLoadWallet([this](std::unique_ptr<interfaces::Wallet> wallet) {
|
||||
getOrCreateWallet(std::move(wallet));
|
||||
@@ -104,7 +106,7 @@ WalletModel* WalletController::getOrCreateWallet(std::unique_ptr<interfaces::Wal
|
||||
}
|
||||
|
||||
// Instantiate model and register it.
|
||||
WalletModel* wallet_model = new WalletModel(std::move(wallet), m_node, m_platform_style, m_options_model, nullptr);
|
||||
WalletModel* wallet_model = new WalletModel(std::move(wallet), m_client_model, m_platform_style, nullptr);
|
||||
// Handler callback runs in a different thread so fix wallet model thread affinity.
|
||||
wallet_model->moveToThread(thread());
|
||||
wallet_model->setParent(this);
|
||||
|
||||
Reference in New Issue
Block a user