perf(node): skip the mining-info poll during sync too

The sync throttle (kSyncProfile) covers the core/transactions/addresses/peers timers, but
getmininginfo runs off the separate 1s Fast timer and so still polled ~every 5s during
sync — another cs_main contender slowing block connection. Skip it while syncing unless the
user is on the Mining tab or actively mining (where live stats are wanted). Completes the
"no RPC contention during sync beyond the 10s progress poll" goal.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 15:21:44 -05:00
parent 323cb341f1
commit 9f82bba260

View File

@@ -1473,6 +1473,12 @@ void App::refreshMiningInfo()
bool doSlowRefresh = (mining_slow_counter_++ % 5 == 0);
bool includeLocalHashrate = state_.mining.generate || current_page_ == ui::NavPage::Mining;
if (!includeLocalHashrate && !doSlowRefresh) return;
// While syncing, don't poll getmininginfo (another cs_main contender) unless the user is
// actually on the Mining tab or mining — mining stats are irrelevant mid-sync, and this keeps
// the sync throttle complete (the mining poll runs off the separate 1s Fast timer, so the
// sync-profile intervals don't otherwise cover it).
if (state_.sync.syncing && !includeLocalHashrate) return;
ui::NavPage tracePage = current_page_;
auto enqueued = network_refresh_.enqueue(services::NetworkRefreshService::Job::Mining, *w,