fix(mining): restore the miner after a benchmark only if it was running

Cancelling a thread benchmark always stopped and restarted the pool
miner at its pre-benchmark thread count, even when the user had not been
mining before the benchmark began. That silently started the miner on a
plain cancel or a switch to solo mode.

- A cancel now always drops the candidate-thread miner, and restarts the
  pool miner only when the user was mining before the benchmark, read
  from a snapshot taken at the start rather than the live running state
  (the benchmark sweep transiently stops the miner between candidates,
  so a live check would drop the restore).
- Callers that must not restore the miner (leaving solo mode) pass the
  new restore flag as false.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-10-13 16:00:10 -05:00
co-authored by Claude Opus 4.8
parent 13989cf268
commit fae5ef05b9
5 changed files with 28 additions and 12 deletions
+1 -1
View File
@@ -117,7 +117,7 @@ void RenderMiningModeToggle(App* app, const WalletState& state, const MiningInfo
s_pool_mode = false;
app->settings()->setPoolMode(false);
app->settings()->save();
CancelMiningBenchmark(app); // don't leave a pool benchmark running after switching to solo (L-11)
CancelMiningBenchmark(app, false); // don't leave a pool benchmark running after switching to solo (L-11)
app->stopPoolMining();
}
if (soloHov) ImGui::SetMouseCursor(ImGuiMouseCursor_Hand);