dgb(#82): run-loop spine — io_context + graceful signal_set shutdown (--run) - #182
Merged
Conversation
frstrtr
force-pushed
the
dgb/run-loop-skeleton
branch
from
June 19, 2026 07:54
f9dd2fd to
b464ce0
Compare
frstrtr
added a commit
that referenced
this pull request
Jun 19, 2026
…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.
frstrtr
force-pushed
the
dgb/run-loop-skeleton
branch
from
June 19, 2026 08:04
b464ce0 to
84a6c9d
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).
frstrtr
force-pushed
the
dgb/run-loop-skeleton
branch
from
June 19, 2026 11:07
c1cdc33 to
55dbd05
Compare
frstrtr
added a commit
that referenced
this pull request
Jun 19, 2026
…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.
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.
What
Stands up the run-loop spine in
main_dgb.cppbehind a new--runflag: aboost::asio::io_context+ explicit graceful shutdown fromsignal_set(SIGINT, SIGTERM), mirroringmain_btc.cpps teardown contract.Why (#82)
This is the lifecycle every node subsystem (sharechain peer
dgb::Node, embedded digibyted P2P, Stratum acceptor) and the won-block dispatch handler hang off. The #82 connecting tissue is landed across #163/#166/#167/#173/#174/#176/#177/#179; the remaining closer is binding it into a live run-loop. Standing the spine up first keeps the next increments — node/Config construction (opens LevelDB), P2P listen, Stratum, and them_on_block_found -> reconstruct_won_block -> broadcast_won_blockbinding — each build-verifiable rather than landing a large unverified port in one step.Scope / preserved
--selftest/ bare invocation unchanged (liveShareTracker::score()path, block_period=75s SSOT).src/c2pool/main_dgb.cpptouched. No shared base / CMake / build.yml change.Verification
c2pool-dgblinks EXIT=0 (-DCOIN_DGB=ON).--selftest: OK (oracle identifier 4b62545b1a631afe, block_period=75s).--run: spine up, SIGINT -> graceful shutdown -> clean exit 0.Next stacked slice
Construct
dgb::Config+dgb::Node(&ioc,&config), listen on the sharechain P2P port, stand up Stratum, and bindmake_on_block_found(...)intom_on_block_found(closes #82 won-block-reaches-network).HOLD merge.