HomePhabricator

gui: Avoid Wallet::GetBalance in WalletModel::pollBalanceChanged

Description

gui: Avoid Wallet::GetBalance in WalletModel::pollBalanceChanged

Summary:

Each 250ms the slot WalletModel::pollBalanceChanged is called which, at worst case, calls Wallet::GetBalance. This is a waste of resources since most of the time there aren't new transactions or new blocks. Fix this by early checking if cache is dirty or not.

This is a backport of Core PR18160

See D7938 (Remove locked_chain from CWallet) for why the src/interfaces/wallet.cpp diff looks different

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D8896

Details

Provenance
João Barbosa <joao.paulo.barbosa@gmail.com>Authored on Wed, Jan 13, 12:56
PiRKCommitted on Wed, Jan 13, 12:57
abc-botPushed on Wed, Jan 13, 13:03
Reviewer
Restricted Project
Differential Revision
D8896: gui: Avoid Wallet::GetBalance in WalletModel::pollBalanceChanged
Parents
rABCa05e018b9578: test: check that peer is connected when calling sync_*
Branches
Unknown
Tags
Unknown