Reduce redundant RPC calls in periodic refresh cycle
- Remove getinfo from refreshMiningInfo slow path; daemon_version, protocol_version, and p2p_port are static per connection (set in onConnected). Move longestchain/notarized into refreshBalance's existing getblockchaininfo callback. - Remove refreshMiningInfo from refreshData(); it already runs on the 1-second fast_refresh_timer_ independently. - Make refreshAddresses demand-driven via addresses_dirty_ flag; only re-fetch when a new address is created or a send completes, not unconditionally every 5 seconds. - Gate refreshPeerInfo to only run when the Peers tab is active. - Skip duplicate getwalletinfo on connect; onConnected() already prefetches it for immediate lock-screen display, so suppress the redundant call in the first refreshData() cycle. Steady-state savings: ~8 fewer RPC calls per 5-second cycle (from ~12+ down to ~4-5 in the common case).
This commit is contained in:
@@ -422,6 +422,10 @@ private:
|
||||
// P4: Incremental transaction cache
|
||||
int last_tx_block_height_ = -1; // block height at last full tx fetch
|
||||
|
||||
// Dirty flags for demand-driven refresh
|
||||
bool addresses_dirty_ = true; // true → refreshAddresses() will run
|
||||
bool encryption_state_prefetched_ = false; // suppress duplicate getwalletinfo on connect
|
||||
|
||||
// First-run wizard state
|
||||
WizardPhase wizard_phase_ = WizardPhase::None;
|
||||
std::unique_ptr<util::Bootstrap> bootstrap_;
|
||||
|
||||
Reference in New Issue
Block a user