ltc(no-embed): recurring GBT poll so RPC-only nodes recover template#727
Merged
Conversation
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In
--no-embedded-ltcmode a c2pool node has no embedded LTC HeaderChain, so the work-template cache is only bootstrapped by the single one-shot startuprefresh_work()(web_server.cpp:8414). If the parent litecoind is still in IBD at that instant,m_work_validstays 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:getblocktemplatereturns 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.