Skip to content

dgb(#82): won-block reconstructor body — compose resolve+assemble+frame (as_block) - #177

Merged
frstrtr merged 1 commit into
dgb/won-block-other-tx-assemblefrom
dgb/won-block-reconstruct-body
Jun 19, 2026
Merged

dgb(#82): won-block reconstructor body — compose resolve+assemble+frame (as_block)#177
frstrtr merged 1 commit into
dgb/won-block-other-tx-assemblefrom
dgb/won-block-reconstruct-body

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Stacked on #176. Ties the three landed #82 sub-slices into the single composition the dispatch handler (#167) injects as its WonBlockReconstructor:

resolve_other_tx_hashes (#174) -> assemble_other_txs (#176) -> assemble_won_block (#168 framing)

Faithful port of p2pool data.py Share.as_block — produces {bytes,hex} for broadcast_won_block dual path. Gentx enters as a deserialized MutableTransaction + txid; the SSOT gentx-bytes -> MutableTransaction unpack (inverse of #173 exposure) is the explicitly-next slice. Injected tracker/known_txs seams keep it unit-testable; per-step out_of_range propagation preserved (never emit a partial/wrong block).

dgb_reconstruct_won_block_test 5/5 PASS, build EXIT=0:

  • end-to-end == manual resolve+assemble+frame (byte-identical, hex==HexStr)
  • [gentx]++other_txs in transaction_hash_refs order, coinbase at index 0
  • empty refs => gentx-only block
  • ref-past-chain + unknown-known-tx each throw std::out_of_range
    Wired into test/CMakeLists.txt + BOTH build.yml --target allowlists (ci: build test_dgb_subsidy in both Linux test jobs (fix master-red NOT_BUILT) #143 NOT_BUILT trap avoided).

Per-coin isolation: src/impl/dgb/ only. p2pool-merged-v36 surface: NONE. HOLD merge (integrator merges on operator approval; stack lands bottom-up).

…me as_block

Tie the three landed sub-slices into the single composition the dispatch
handler injects as its WonBlockReconstructor:
  resolve_other_tx_hashes (#174) -> assemble_other_txs (#176)
  -> assemble_won_block (#168 framing)

Faithful port of p2pool data.py Share.as_block: produces {bytes, hex} for
broadcast_won_block dual path. Gentx enters as a deserialized
MutableTransaction + txid (the SSOT gentx-bytes -> MutableTransaction unpack,
inverse of #173 exposure, is the next slice). Injected tracker/known_txs
seams keep it unit-testable; out_of_range propagation from each step
preserved (never emit a partial/wrong block).

dgb_reconstruct_won_block_test 5/5 PASS: end-to-end == manual
resolve+assemble+frame (byte-identical), [gentx]++others in ref order,
empty-refs gentx-only, ref-past-chain + unknown-known-tx throw. Wired into
test/CMakeLists.txt + both build.yml --target allowlists (#143 trap).

Per-coin isolation: src/impl/dgb/ only. p2pool-merged-v36 surface: none.
@frstrtr
frstrtr force-pushed the dgb/won-block-other-tx-assemble branch from a11b3f7 to 24971a5 Compare June 19, 2026 01:44
@frstrtr
frstrtr force-pushed the dgb/won-block-reconstruct-body branch from c48328d to 3b6f5d8 Compare June 19, 2026 01:44
@frstrtr
frstrtr merged commit ee1a4b4 into dgb/won-block-other-tx-assemble Jun 19, 2026
1 check passed
frstrtr added a commit that referenced this pull request Jun 19, 2026
…(--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.
frstrtr added a commit that referenced this pull request Jun 19, 2026
…(--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.
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 added a commit that referenced this pull request Jun 19, 2026
…(--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.
frstrtr added a commit that referenced this pull request Jun 19, 2026
…(--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.
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.
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