Skip to content

dgb(#82): resolve transaction_hash_refs -> ordered other_tx hashes (reconstructor sub-slice 1) - #174

Merged
frstrtr merged 1 commit into
dgb/won-block-gentx-exposefrom
dgb/won-block-other-tx-walk
Jun 19, 2026
Merged

dgb(#82): resolve transaction_hash_refs -> ordered other_tx hashes (reconstructor sub-slice 1)#174
frstrtr merged 1 commit into
dgb/won-block-gentx-exposefrom
dgb/won-block-other-tx-walk

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Stacked on #173. Won-block reconstructor (#82) sub-slice 1 — integrator-approved 2026-06-19: resolve a share's transaction_hash_refs to the ordered other_tx hash list via the tracker ancestry walk (not a flat known_txs map).

What

  • New coin/other_tx_resolver.hpp: faithful port of p2pool get_other_tx_hashes. Each (share_count, tx_count) ref walks back share_count generations from the won share (0 == the share itself, matching get_nth_parent_hash(h,0)==h), then indexes tx_count into that ancestor's new_transaction_hashes. Ref order = block other_txs order.
  • The two tracker ops (nth_parent / new_transaction_hashes lookup) are injected as callables — same seam-first decomposition as won_block_dispatch.hpp — so the walk is unit-testable against a synthetic ancestry with no live ShareTracker. Run-loop binds them to chain.get_nth_parent_via_skip + chain.get_share(h).invoke(...m_tx_info.m_new_transaction_hashes).
  • Malformed refs (tx_count OOB / walk past chain end) throw std::out_of_range rather than emit a wrong hash.

Why ref-walk, not flat map

Per integrator: a flat known_txs[hash] lookup resolves the same hashes on the happy path but diverges the moment two ancestors announce the same txid or a ref points past the locally-known set — it cannot reproduce how the sharechain actually addresses a tx.

Test

dgb_other_tx_resolver_test — 6 gtests (self-share refs, ancestor walk-back, mixed-order preservation, empty refs, tx_count-OOB throw, walk-past-chain-end throw). 6/6 PASS, build EXIT=0. Wired into ctest + both build.yml --target allowlists (#143 trap avoided).

Scope

Single-coin (src/impl/dgb/ only). No shared base / CMake-root / p2pool-merged-v36 surface — only re-reads share_info already validated by share_check. HOLD merge (integrator gates; no self-merge).

Won-block reconstructor connecting tissue (sub-slice 1): faithful port of
p2pool get_other_tx_hashes ancestry resolution. coin/other_tx_resolver.hpp
walks each (share_count, tx_count) ref back share_count generations from the
won share (0 == the share itself) and indexes tx_count into that ancestors
new_transaction_hashes, preserving ref order = block other_txs order.

The two tracker ops (nth_parent / new_transaction_hashes lookup) are injected
as callables, mirroring the seam-first decomposition of won_block_dispatch.hpp,
so the walk is unit-testable against a synthetic ancestry without a live
ShareTracker. Reuses the tracker ancestry walk rather than a flat known_txs
map: a flat lookup cannot reproduce how the sharechain addresses a tx and
diverges on duplicate txids or refs past the locally-known set.

Malformed refs (tx_count OOB, share_count past chain end) throw rather than
emit a wrong hash. 6 gtests pin self-share/walk-back/order/empty/both throws.
Single-coin (src/impl/dgb/ only); no shared base / p2pool-merged-v36 surface.
Test wired into ctest + both build.yml --target allowlists (#143).
@frstrtr
frstrtr force-pushed the dgb/won-block-gentx-expose branch from 4ab5495 to 7b1f57a Compare June 19, 2026 01:44
@frstrtr
frstrtr force-pushed the dgb/won-block-other-tx-walk branch from 3e895b0 to 885938d Compare June 19, 2026 01:44
frstrtr added a commit that referenced this pull request Jun 19, 2026
…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 merged commit ad3c6af into dgb/won-block-gentx-expose 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
…(--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.
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