Skip to content

btc: save graph_db stat log on clean shutdown (LTC-parity site 3/3) - #1100

Draft
frstrtr wants to merge 1 commit into
masterfrom
btc/liveadapter-save-on-shutdown
Draft

btc: save graph_db stat log on clean shutdown (LTC-parity site 3/3)#1100
frstrtr wants to merge 1 commit into
masterfrom
btc/liveadapter-save-on-shutdown

Conversation

@frstrtr

@frstrtr frstrtr commented Aug 4, 2026

Copy link
Copy Markdown
Owner

What

src/c2pool/main_btc.cpp stands up the graph_db stat-log with only 2 of LTC's 3 persistence sites:

  • Site 1 — load-on-start: main_btc.cpp:1722 mi->load_stat_log();
  • Site 2 — periodic-100s: main_btc.cpp:1735 mi->save_stat_log();
  • Site 3 — save-on-shutdown: absent (LTC has it at main_ltc.cpp:7456-7457).

Effect: everything accumulated in the final sub-100s window is dropped on every clean restart. The dashboard series only survives when a periodic tick happens to land before shutdown. Same 2/3 gap DGB fixed in #1097.

Change

One null-guarded call added after the run loop returns (the while (!shutdown_initiated) run_for-slice loop), while web_server and its MiningInterface are still alive, before the graceful-teardown resets:

if (web_server) {
    if (auto* mi = web_server->get_mining_interface())
        mi->save_stat_log();
}

Mirrors #1097 / dgb 822eaa347 exactly, adapted to BTC line numbers.

Isolation

src/c2pool/main_btc.cpp only — BTC's own entrypoint. Zero src/core, zero cross-coin (no main_ltc.cpp / main_dgb.cpp touched). p2pool-merged-v36 surface: NONE (operator dashboard stat log, not share/PPLNS/coinbase bytes).

Evidence

(live restart-persist proof captured below — tick lands, clean restart, series survives the shutdown boundary)

main_btc.cpp stood up load-on-start (:1722) + periodic-100s (:1735)
persistence but omitted the save-on-shutdown site LTC has at
main_ltc.cpp:7456-7457. Without it, every clean restart drops whatever
accumulated in the graph_db stat log since the last 100s tick, so the
dashboard series only survives when a periodic tick happens to land
before shutdown.

Add the third call site after the run loop returns, while web_server
(and its MiningInterface) is still alive, before the teardown resets.
Isolation: src/c2pool/main_btc.cpp only, zero src/core, zero cross-coin.
p2pool-merged-v36 surface: NONE (operator dashboard stat log, not
share/PPLNS/coinbase bytes).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant