Files
ObsidianDragon/src/ui/windows/mining_tab.h
T
DanSandClaude Opus 4.8 32ea4d0524 fix(mining): keep the thread benchmark running while the tab is hidden
The thread benchmark state machine was advanced from the Mining tab's
render path, so it only progressed while that tab was visible and the
window was on screen. Hiding the tab or minimizing the window froze the
benchmark mid-sweep.

- The benchmark now advances from the main update loop, ungated by
  connectivity, so it keeps running when the tab is hidden or the window
  is minimized.
- Its clock is driven from a steady wall-clock reading rather than the
  render delta, and each step is clamped like the other logic timers so
  a suspend/resume cannot leap a benchmark phase.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-13 16:00:10 -05:00

39 lines
1.0 KiB
C++

// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
#pragma once
namespace dragonx {
class App;
namespace ui {
/**
* @brief Render the Mining tab
* Controls for CPU mining with RandomX
*/
void RenderMiningTab(App* app);
/**
* @brief Returns true when the thread benchmark is actively running.
* Used by idle mining to avoid interfering with measurements.
*/
bool IsMiningBenchmarkActive();
/**
* @brief Cancel a running thread benchmark and restore the miner only if it was running before the benchmark.
* Safe to call when no benchmark is active (no-op). Used when leaving the Mining tab or switching to
* solo mode so the miner isn't left stuck at a benchmark step. (L-04, L-11)
*/
void CancelMiningBenchmark(App* app, bool restoreMiner = true);
/**
* @brief Advance the thread benchmark state machine. Call once per App::update() (ungated by connectivity).
* No-op when no benchmark is active.
*/
void TickMiningBenchmark(App* app, double hashrate10s);
} // namespace ui
} // namespace dragonx