From 821bebd13ef636a74a8604e75493d0e765aacfe7 Mon Sep 17 00:00:00 2001 From: DanS Date: Fri, 2 Oct 2026 00:02:27 -0500 Subject: [PATCH] test(tools): add FAKE_REBUILD_SILENT to fake_dragonxd Holds cs_main like a witness rebuild but logs no rebuild markers: a node that is busy while its output says nothing (an external node, or a rebuild path that prints no progress), for exercising the GUI's "busy but alive" handling. Co-Authored-By: Claude Opus 5.5 --- tools/fake_dragonxd/README.md | 1 + tools/fake_dragonxd/fake_dragonxd.cpp | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/fake_dragonxd/README.md b/tools/fake_dragonxd/README.md index db438dc..d1a8100 100644 --- a/tools/fake_dragonxd/README.md +++ b/tools/fake_dragonxd/README.md @@ -117,6 +117,7 @@ inherits the GUI's environment. | `FAKE_SERVER_TIMEOUT_SECS` | 30 | idle keep-alive connections are closed (`-rpcservertimeout`) | | `FAKE_PREFILL` | 0 | inject N abandoned requests when the rebuild starts (`24` = saturated) | | `FAKE_MINING` | 0 | internal miner on: `stop` waits for cs_main first (`GenerateBitcoins` join) | +| `FAKE_REBUILD_SILENT` | 0 | hold cs_main like a rebuild but log no rebuild markers (a busy node whose output says nothing) | | `FAKE_STUCK_SHUTDOWN` | 0 | the Sep 29 orphan: hold the datadir lock, no listener, ignore SIGTERM, never exit | | `FAKE_HEIGHT`, `FAKE_REBUILD_TOTAL`, `FAKE_NOTES`, `FAKE_VERSION` | 3327145, 62583, 13632, 1030050 | cosmetic numbers | diff --git a/tools/fake_dragonxd/fake_dragonxd.cpp b/tools/fake_dragonxd/fake_dragonxd.cpp index 0368706..6f917aa 100644 --- a/tools/fake_dragonxd/fake_dragonxd.cpp +++ b/tools/fake_dragonxd/fake_dragonxd.cpp @@ -122,6 +122,7 @@ struct Config { long version = 1030050; // getinfo "version" (real v1.3.0 reports 1030050) bool stuckShutdown = false; // the Sep 29 orphan: datadir lock held, no listener, never exits bool mining = false; // internal miner on: `stop` must wait for cs_main first + bool rebuildSilent = false; // hold cs_main like a rebuild but log no rebuild markers at all }; Config g_cfg; @@ -1011,15 +1012,16 @@ void rebuildLoop() event("rebuild-aborted"); return; } - logf("Reading blocks for witness rebuild: %ld / %ld", off, g_cfg.rebuildTotal); + if (!g_cfg.rebuildSilent) logf("Reading blocks for witness rebuild: %ld / %ld", off, g_cfg.rebuildTotal); std::this_thread::sleep_for(std::chrono::duration(step)); } const auto phase2End = started + std::chrono::duration_cast(std::chrono::duration(g_cfg.rebuildSecs)); std::this_thread::sleep_until(phase2End); // Phase 2: silent, and deaf to shutdown const long long ms = std::chrono::duration_cast(Clock::now() - started).count(); - logf("BuildWitnessCache: rebuilt %ld note witness cache(s) to height %ld in %lldms using %d thread(s)", - g_cfg.notes, endHeight, ms, 8); + if (!g_cfg.rebuildSilent) + logf("BuildWitnessCache: rebuilt %ld note witness cache(s) to height %ld in %lldms using %d thread(s)", + g_cfg.notes, endHeight, ms, 8); event("rebuild-end", "ms=" + std::to_string(ms)); if (g_cfg.postRebuildLockSecs > 0) std::this_thread::sleep_for(std::chrono::duration(g_cfg.postRebuildLockSecs)); @@ -1133,6 +1135,7 @@ void loadConfig(int argc, char** argv) g_cfg.version = envLong("FAKE_VERSION", g_cfg.version); g_cfg.stuckShutdown = envLong("FAKE_STUCK_SHUTDOWN", 0) != 0; g_cfg.mining = envLong("FAKE_MINING", 0) != 0; + g_cfg.rebuildSilent = envLong("FAKE_REBUILD_SILENT", 0) != 0; } std::string knobsLine() @@ -1140,11 +1143,11 @@ std::string knobsLine() char buf[512]; std::snprintf(buf, sizeof(buf), "warmup=%gs replay=%gs rebuild=%gs after=%gs phase1=%gs post_lock=%gs flush=%gs tip=%gs " - "prefill=%ld version=%ld workers=%d depth=%d port=%d console=%d mining=%d", + "prefill=%ld version=%ld workers=%d depth=%d port=%d console=%d mining=%d silent=%d", g_cfg.warmupSecs, g_cfg.replaySecs, g_cfg.rebuildSecs, g_cfg.rebuildDelaySecs, g_cfg.phase1Secs, g_cfg.postRebuildLockSecs, g_cfg.flushSecs, g_cfg.updateTipSecs, g_cfg.prefill, g_cfg.version, g_cfg.rpcThreads, g_cfg.rpcWorkQueue, g_cfg.rpcPort, g_cfg.printToConsole ? 1 : 0, - g_cfg.mining ? 1 : 0); + g_cfg.mining ? 1 : 0, g_cfg.rebuildSilent ? 1 : 0); return buf; }