bucket-A2: extract enhanced_node into coin-agnostic template (SAFE-ADDITIVE)#48
Conversation
…DITIVE) Lifts the EnhancedC2PoolNode implementation out of the compiled src/c2pool/node/enhanced_node.cpp into a header-only, coin-agnostic template EnhancedC2PoolNodeT<Config, ShareChain, Peer, ShareType> in the new enhanced_node_impl.hpp. enhanced_node.hpp becomes a thin backward-compat header that pins the template to LTC types (EnhancedC2PoolNode = EnhancedC2PoolNodeT<ltc::...>), so existing callers compile unchanged. c2pool_node_enhanced becomes an INTERFACE (header-only) library; the two executables that consume it (c2pool, c2pool_enhanced) already link `ltc` directly, so dropping `ltc` from the library's transitive deps is a no-op for the LTC build. Pure refactor — LTC behavior identical. The Dash specialization (src/impl/dash/enhanced_node.hpp) is deferred to Bucket B with the rest of src/impl/dash/, since master has no dash impl directory yet and that shim references not-yet-landed dash headers. Cherry-picked from dash-spv-embedded HEAD 8249dc2. 4 files, +251 / -368: - new src/c2pool/node/enhanced_node_impl.hpp (template) - modified src/c2pool/node/enhanced_node.hpp (LTC alias shim) - deleted src/c2pool/node/enhanced_node.cpp (impl moved to template) - modified src/c2pool/CMakeLists.txt (library -> INTERFACE)
|
Review verdict (ltc-doge-production-steward, LTC+DOGE production perspective): APPROVE — SAFE-ADDITIVE label holds. @Integrator ready to merge (push approval needed from operator). Reviewed at A1 depth: full 1. API surface — no symbol removed or renamed. Every public method of 2. Caller sweep — clean. Only consumer is 3. Library→INTERFACE conversion — link no-op, no ABI risk. The deleted 4. CI — green on the load-bearing checks. Linux x86_64 PASS (8m34s), ltc/doge/btc/dash smokes PASS, Windows + macOS arm64 + CodeQL + Analyze(c-cpp) all PASS. (Noting per convention that macOS skips the test build; Linux x86_64 is the one that gates and it's green.) 5. Dash shim deferral — reasoning holds. Non-blocking note (not a regression): the PR body says "LTC behavior identical," but it is not strictly byte-identical — the template's Recommend merge. Integrator: routing the push ask to you. — ltc-doge-production-steward |
Summary
Lifts the
EnhancedC2PoolNodeimplementation out of the compiledsrc/c2pool/node/enhanced_node.cppinto a header-only, coin-agnostic templateEnhancedC2PoolNodeT<Config, ShareChain, Peer, ShareType>(newenhanced_node_impl.hpp).enhanced_node.hppbecomes a thin backward-compat header pinning the template to LTC types, so existing callers compile unchanged. Pure refactor — LTC behavior identical (audit classification: SAFE-ADDITIVE).4 files, +251 / −368:
src/c2pool/node/enhanced_node_impl.hpp(coin-agnostic template)src/c2pool/node/enhanced_node.hpp(LTC alias shim:EnhancedC2PoolNode = EnhancedC2PoolNodeT<ltc::...>)src/c2pool/node/enhanced_node.cpp(impl moved to template header)src/c2pool/CMakeLists.txt(c2pool_node_enhancedlibrary → INTERFACE)Cherry-picked from
dash-spv-embeddedHEAD8249dc28.Context
Part 2 of the bucket-A sub-PRs implementing the multi-coin landing strategy (single master + directory contract + coin-matrix CI + per-coin release branches). Follows #46 (A1, bitcoin_family base extraction), still under review — A2 is independent and does not depend on A1.
Why this is safe for LTC+DOGE
EnhancedC2PoolNodekeeps the same name and public API; the only consumer,src/c2pool/c2pool_refactored.cpp, is untouched by this PR.c2pool_node_enhancedbecomes an INTERFACE (header-only) library. The two executables that link it (c2pool,c2pool_enhanced) already linkltcdirectly (CMakeLists.txt lines 78–90 on master), so droppingltcfrom the library's transitive deps is a no-op for the link step.src/c2pool/node/andsrc/c2pool/CMakeLists.txtis touched.Plan deviation (mirrors A1's precedent)
The strategy doc advertised A2 as "4 files" counting the Dash specialization
src/impl/dash/enhanced_node.hpp. That shim is deferred to Bucket B: master has nosrc/impl/dash/directory yet, and the shim#includes not-yet-landed dash headers (config.hpp,share_chain.hpp,peer.hpp) — landing it here would be a dangling, non-building file and a directory-contract violation. A2 instead ships the CMake conversion as its 4th file (required because the.cppis deleted). Net file count unchanged; scope stays clean and buildable on master. No other A-series ordering/scope changes.CI expectation
linux:job (full test suite) + cross-platform + CodeQL: must be green — that's what gates merge.src/impl/<coin>/main_<coin>.cpppresent). Real matrix exercise comes with Bucket B.Reviewer
Agent-side reviewer: ltc-doge-production-steward (watches the branch; no assignment needed). Integrator (cc) routes human review.
Test plan
linux:CI green (full test suite)src/c2pool/node/+src/c2pool/CMakeLists.txttouched (directory-contract spot-check)