fix: Tier-2 remaining mediums — maintenance/mining feedback + force-quit hang detection
The last four (more involved) robustness items from the audit:
- deleteBlockchainData: post the deleted-item count to the main thread (via an
atomic, since Notifications isn't thread-safe) and show a completion toast
("Blockchain data deleted (N items). Daemon restarting…") — previously the
result was only logged.
- Pool mining: pool start has a connect delay with no feedback; announce
"Starting pool miner — connecting…" on a successful start and "Pool miner
connected and hashing." once the poll confirms it (contained pool_starting_
flag; the shared mining-toggle state machine is untouched).
- Force Quit (shutdown screen): gate it on the status text having STALLED (a
genuine hang) rather than a bare 10s timer — with a 20s hard-ceiling backstop —
and show a state-aware caution naming the stuck step (force-quitting mid daemon
flush risks the chainstate).
- Benchmark: require a confirming second click that first builds candidates to
estimate the duration ("Benchmark takes ~Ns and interrupts mining"), instead
of interrupting mining immediately.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -453,14 +453,27 @@ void RenderMiningControls(App* app, const WalletState& state, const MiningInfo&
|
||||
// Require a wallet address for pool mining
|
||||
std::string worker(s_pool_worker);
|
||||
if (!worker.empty()) {
|
||||
s_benchmark.reset();
|
||||
s_benchmark.was_pool_running = state.pool_mining.xmrig_running;
|
||||
s_benchmark.prev_threads = s_selected_threads;
|
||||
s_benchmark.buildCandidates(max_threads);
|
||||
s_benchmark.phase = ThreadBenchmark::Phase::Starting;
|
||||
// Stop any active solo mining first
|
||||
if (mining.generate)
|
||||
app->stopMining();
|
||||
static bool s_benchConfirm = false;
|
||||
if (!s_benchConfirm) {
|
||||
// First click: build candidates so we can estimate the total duration, then
|
||||
// require a confirming click (the benchmark interrupts mining and runs a while).
|
||||
s_benchmark.reset();
|
||||
s_benchmark.buildCandidates(max_threads);
|
||||
s_benchConfirm = true;
|
||||
char msg[128];
|
||||
snprintf(msg, sizeof(msg),
|
||||
"Benchmark takes ~%ds and interrupts mining. Click again to start.",
|
||||
(int)(s_benchmark.totalEstimatedSecs() + 0.5f));
|
||||
Notifications::instance().warning(msg);
|
||||
} else {
|
||||
// Second click: start (candidates already built above).
|
||||
s_benchConfirm = false;
|
||||
s_benchmark.was_pool_running = state.pool_mining.xmrig_running;
|
||||
s_benchmark.prev_threads = s_selected_threads;
|
||||
s_benchmark.phase = ThreadBenchmark::Phase::Starting;
|
||||
if (mining.generate)
|
||||
app->stopMining();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user