Skip to content

ltc(no-embed): recurring GBT poll so RPC-only nodes recover template#727

Merged
frstrtr merged 1 commit into
masterfrom
ltc-doge/noembed-gbt-poll-recover
Jul 17, 2026
Merged

ltc(no-embed): recurring GBT poll so RPC-only nodes recover template#727
frstrtr merged 1 commit into
masterfrom
ltc-doge/noembed-gbt-poll-recover

Conversation

@frstrtr

@frstrtr frstrtr commented Jul 17, 2026

Copy link
Copy Markdown
Owner

Problem

In --no-embedded-ltc mode a c2pool node has no embedded LTC HeaderChain, so the work-template cache is only bootstrapped by the single one-shot startup refresh_work() (web_server.cpp:8414). If the parent litecoind is still in IBD at that instant, m_work_valid stays false forever — there is no recurring driver, because all later refreshes are event-driven off the embedded on_new_headers callback that RPC-only nodes never receive. Result: getblocktemplate returns valid work but c2pool never consumes it → stratum withholds work (stratum_server.cpp:1271) → verified=0 permanently.

Fix

Add a 2s recurring getblocktemplate poll gated on has_rpc() && !is_embedded(), placed right after the existing one-shot refresh. It bootstraps the cache once the parent daemon clears IBD and notify_all() on tip-change. Embedded and other-coin paths are untouched. Preserves the standing "keep litecoind/dogecoind RPC fallback" invariant — embedded stays primary, RPC-only nodes now self-heal.

Evidence (live)

Deployed on VM213 counterweight (RPC-only, parent .197 fully synced): verified went 0 -> 8640 on relaunch, PPLNS building, template value 6.26 LTC valid. Single file, +37 lines.

Scope

Load-bearing for the #97 v35 counterweight (RPC-only v35-seed node) and generally correct for any RPC-fallback deployment. Distinct from the test-only C2POOL_DESIRED_VERSION scaffolding, which stays on the testbed branch and is not proposed here. Reviewer lane authored this; integrator merges.

In --no-embedded-ltc mode the sole template refresh was a one-shot 500ms
fetch; all later refreshes are event-driven off the embedded header-sync
on_new_headers callback, which RPC-only nodes never have. If the daemon was
still in IBD at the one-shot, m_work_valid stayed false forever (verified=0,
Waiting for block template) even after the daemon fully synced and GBT worked.

Add a 2s recurring getblocktemplate poll on the has_rpc \&\& !is_embedded path
that bootstraps the cache once IBD clears and re-notifies miners on tip change,
replacing the event source embedded mode gets for free. Embedded/other-coin
paths untouched (gated on !is_embedded).

(cherry picked from commit bb5bfe9)
@frstrtr
frstrtr merged commit a99089f into master Jul 17, 2026
26 checks passed
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