dgb(#82): stand StratumServer up in main_dgb.cpp --run — submitblock-RPC arm wired - #187
Merged
Conversation
frstrtr
force-pushed
the
dgb/stratum-standup-closer
branch
from
June 19, 2026 08:04
5205645 to
1a561f9
Compare
…(--run) Stand up the run-loop spine in main_dgb.cpp behind a new --run flag: a boost::asio::io_context plus an explicit graceful shutdown driven from signal_set(SIGINT, SIGTERM), mirroring main_btc.cpp s teardown contract. This is the lifecycle every node subsystem (sharechain peer dgb::Node, embedded digibyted P2P, Stratum acceptor) and the #82 won-block dispatch handler hangs off. Standing the spine up first keeps the next increments (node/Config construction over LevelDB, P2P listen, Stratum, and the m_on_block_found -> reconstruct_won_block -> broadcast_won_block binding landed across #163/#166/#167/#173/#174/#176/#177/#179) build-verifiable rather than landing a large unverified port in one step. --selftest / bare invocation unchanged (live ShareTracker::score() path). External digibyted RPC fallback posture preserved. Build: c2pool-dgb links EXIT=0 (-DCOIN_DGB=ON). Smoke: --selftest OK (block_period=75s SSOT); --run spine up, SIGINT -> clean shutdown exit 0.
…run) Second stacked run-loop slice. main_dgb.cpp --run now constructs the real dgb::Config + dgb::Node (pool::NodeBridge<NodeImpl, Legacy, Actual>) on the spine io_context, opens the sharechain LevelDB, and binds the P2P listener on PoolConfig::P2P_PORT (5024) — the sharechain peer is live, not just the io_context spine. Config is set directly from the p2pool-dgb-scrypt oracle constants (PREFIX 1c0553f2..., IDENTIFIER 4b62545b...), skipping Config::init() yaml load, the same contract main_btc.cpp uses. DEFAULT_BOOTSTRAP_HOSTS is empty until DGB p2pool nodes come online, so there are no outbound seeds to dial this slice; the node listens and waits for inbound peers. The per-coin net dir is digibyte/ (bucket-1 isolation). Constructing the node pulls BaseNode::connected (boost::log) and the NodeImpl TU, so the c2pool-dgb exe must link the real dgb pool runtime, not just the header-only score path. Wire the exe to link the dgb OBJECT lib + dgb_coin + core/pool/sharechain/storage base, mirroring the c2pool-btc link set; c2pool_merged_mining is pulled for symbol resolution of the core web_server tangle only (same as c2pool-btc) and does NOT enable -DAUX_DOGE — DGB default build stays standalone. Only the c2pool-dgb target stanza changes; per-coin isolation holds. Build EXIT=0. Smoke: --run binds 0.0.0.0:5024 (ss-confirmed), SIGINT -> graceful shutdown -> clean exit 0, LevelDB closed cleanly; --selftest still drives the live score() path; --version OK. SEAM (next slice): stand up the Stratum work source + bind make_on_block_found(reconstruct_won_block, p2p_sink) into m_on_block_found to close the #82 embedded P2P relay path (submitblock RPC fallback at rpc.cpp:387 is already real, not a stub).
…ks c2pool-dgb The run-loop slice switched c2pool-dgb to link the dgb and dgb_coin OBJECT libs, but both were defined only inside if(COIN_DGB). The coin-matrix CI job configures without -DCOIN_DGB, so the targets were undefined and CMake emitted raw -ldgb/-ldgb_coin, failing the link (cannot find -ldgb). Mirror btc/ltc, which define their per-coin libs unconditionally; keep only the test subtree behind COIN_DGB (build.yml sets the flag and builds those targets). Verified: fresh configure with COIN_DGB=OFF builds + links c2pool-dgb and --help smokes clean (EXIT=0).
…RPC arm wired Stacks on the run-loop (#182 spine + node-construct) and the DGBWorkSource 4a skeleton (#186): closes the SEAM both left for "stand the Stratum work source up + bind the won-block broadcaster." --run now constructs the miner-facing path on the run-loop io_context: - c2pool::dgb::HeaderChain + dgb::coin::Mempool (MVP-unwired this slice — the 4a work source returns default work; mining_submit low-diff-rejects via the 0.0 compute_share_difficulty sentinel BEFORE the broadcaster, so no garbage block is ever emitted) - dgb::coin::CoinNode(nullptr,nullptr) + a SubmitBlockFn bridging block_bytes -> hex -> submit_block_hex (rpc.cpp:387, REAL not a stub): the submitblock-RPC arm of the #82 dual-path broadcaster. has_rpc()==false => returns false LOUDLY (the #163 seam guard: no silent drop). - dgb::stratum::DGBWorkSource + core::StratumServer, gated on a new --stratum [HOST:]PORT flag (mirrors main_btc.cpp). Acceptor lifecycle is wired into the signal_set handler: stratum stop() runs BEFORE ioc.stop() so live miner sessions close cleanly. CMake: link c2pool-dgb against dgb_stratum. Single-coin (no bitcoin_family / src/core touch); core::StratumServer consumed, not modified. No -DAUX_DOGE. Remaining for the #82 closer (NEXT slice): the embedded P2P-relay arm (m_on_block_found -> reconstruct_won_block -> broadcast_won_block) needs the reconstructor stack (#163/#166/#167/#177), HELD off master. Two-arm independent broadcast evidence captured once both arms are live. Build EXIT=0; --run --stratum 127.0.0.1:5022 smoke: StratumServer started, sharechain peer on 5024, SIGINT -> ordered graceful shutdown (stratum stop then clean exit), EXIT=0.
…in-matrix The --run stratum standup links dgb, dgb_coin and dgb_stratum, but all three were defined only inside if(COIN_DGB). The coin-matrix CI configures without -DCOIN_DGB, so the targets were undefined and CMake emitted raw -ldgb/-ldgb_coin/ -ldgb_stratum, failing the link. Mirror btc/ltc: define the per-coin libs unconditionally, keep only the test subtree behind COIN_DGB (build.yml sets it). Verified: fresh configure with COIN_DGB=OFF builds + links c2pool-dgb and --help smokes clean (EXIT=0).
frstrtr
force-pushed
the
dgb/stratum-standup-closer
branch
from
June 19, 2026 11:07
9e68970 to
f8f4554
Compare
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.
#82 dual-path won-block closer — miner-facing Stratum standup (submitblock-RPC arm)
Stacks on the run-loop (#182 spine + node-construct) and the #186 DGBWorkSource 4a skeleton. Closes the SEAM both branches left: stand the Stratum work source up + bridge to the won-block broadcaster.
What
--runnow doesio_context:c2pool::dgb::HeaderChain+dgb::coin::Mempool— MVP-unwired this slice. The 4a work source returns default work;mining_submitlow-diff-rejects via the0.0compute_share_difficultysentinel before the broadcaster, so no garbage block is ever emitted. Same posture btc::stratum landed its skeleton wiring with.dgb::coin::CoinNode(nullptr,nullptr)+ aSubmitBlockFnbridgingblock_bytes -> hex -> submit_block_hex(rpc.cpp:387, REAL, not a stub) — the submitblock-RPC arm of the dual-path broadcaster.has_rpc()==false=> returns false loudly (the dgb(test): lock CoinNode submit/seam contract (#82 RPC-fallback half) #163 seam guard: no silent drop).dgb::stratum::DGBWorkSource+core::StratumServer, gated on a new--stratum [HOST:]PORTflag (mirrorsmain_btc.cpp). Acceptor lifecycle wired into thesignal_sethandler: stratumstop()runs beforeioc.stop()so live miner sessions close cleanly.c2pool-dgbagainstdgb_stratum.Isolation / scope
bitcoin_family/src/coretouch.core::StratumServerconsumed, not modified. No-DAUX_DOGE.Remaining for the closer (NEXT slice)
The embedded P2P-relay arm (
m_on_block_found -> reconstruct_won_block -> broadcast_won_block) needs the reconstructor stack (#163/#166/#167/#177), HELD off master. Once it lands on this base I bind it and capture the two-arm independent broadcast evidence the acceptance gate calls for (kill P2P sink -> submitblock alone broadcasts; kill RPC -> embedded P2P alone broadcasts).Evidence
EXIT=0(-DCOIN_DGB=ON):dgb_stratum+c2pool-dgblink clean.--run --stratum 127.0.0.1:5022smoke:HOLD merge — integrator lands per merge-card; sequencing: #183 net_name first, #182 run-loop, #186 work source, then this.