dgb: stand up worker->mint share-accept seam on DGBWorkSource (Phase B) [HOLD/surface-for-tap] - #295
Merged
Merged
Conversation
mining_submit (work_source.cpp:292) classifies a Scrypt submission three
ways; the won-block outcome already dispatches via SubmitBlockFn, but the
share-difficulty outcome -- "pow_hash <= share target -> record share in
tracker" -- had no seam. This adds the producer half of the worker->mint
run-loop standup, parallel to SubmitBlockFn:
- MintShareInputs: raw-bytes found-share fields (header, coinbase,
subsidy, prev_share/tip, merkle_branches, payout_script, segwit),
decoupled from share/BlockType serialization like SubmitBlockFn.
- MintShareFn + set_mint_share_fn(): the callback main_dgb.cpp binds to
mint_local_share_with_ratchet (run_loop_mint.hpp) -> create_local_share,
where the AutoRatchet chooses the {mint,vote} version pair. Mirrors the
set_best_share_hash_fn idiom (empty until wired).
- try_mint_share(): thread-safe dispatch (copies fn under lock); when
unbound, logs loudly and returns a NULL hash -- no silent drop.
No behavior change: the 4a mining_submit stub still rejects every
submission and never reaches the seam (the classify branch lands in 4d).
+3 KATs (forward+pass-through, empty-until-wired no-silent-drop, stub
does-not-reach), dgb_work_source_test 20/20.
frstrtr
added a commit
that referenced
this pull request
Jun 21, 2026
…ssify->dispatch) [#82 leg-2 / Stage 4d] Replace the Stage-4a mining_submit stub with the live hot path. Reconstruct the 80-byte DGB block header from the JobSnapshot + miner inputs (coinbase = coinb1||en1||en2||coinb2; merkle ascent from the coinbase txid; header = version|prev|merkle|ntime|nbits|nonce, all little-endian / prevhash reversed to internal order), run the DGB-Scrypt PoW digest through the #286 scrypt_pow SSOT, expand both compact targets via compact_to_target, and classify via the Stage-4d submit_classify SSOT (tighten-first): WonBlock -> serialize the full block (BIP144 coinbase witness when segwit active) and hand it to the dual-path broadcaster submit_block_fn (P2P relay + submitblock RPC fallback, #82); scream-never-drop on a won block that reaches no sink. ShareAccept -> forward the found-share fields to try_mint_share (the #295 producer seam -> #294 mint bind); degrades to accepted-without- credit when no mint fn is wired (no silent drop). Reject -> stratum low-difficulty error. work_source.cpp / work_source_test.cpp only; per-coin isolation held. The header layout is byte-for-byte Bitcoin (only the PoW digest differs, Scrypt); no share format, coinbase commitment, or PPLNS math touched -> p2pool-merged-v36 surface NONE. +3 KATs pin the three-way ladder dispatch by job targets (23/23).
frstrtr
added a commit
that referenced
this pull request
Jun 21, 2026
…ssify->dispatch) [#82 leg-2 / Stage 4d] (#297) Replace the Stage-4a mining_submit stub with the live hot path. Reconstruct the 80-byte DGB block header from the JobSnapshot + miner inputs (coinbase = coinb1||en1||en2||coinb2; merkle ascent from the coinbase txid; header = version|prev|merkle|ntime|nbits|nonce, all little-endian / prevhash reversed to internal order), run the DGB-Scrypt PoW digest through the #286 scrypt_pow SSOT, expand both compact targets via compact_to_target, and classify via the Stage-4d submit_classify SSOT (tighten-first): WonBlock -> serialize the full block (BIP144 coinbase witness when segwit active) and hand it to the dual-path broadcaster submit_block_fn (P2P relay + submitblock RPC fallback, #82); scream-never-drop on a won block that reaches no sink. ShareAccept -> forward the found-share fields to try_mint_share (the #295 producer seam -> #294 mint bind); degrades to accepted-without- credit when no mint fn is wired (no silent drop). Reject -> stratum low-difficulty error. work_source.cpp / work_source_test.cpp only; per-coin isolation held. The header layout is byte-for-byte Bitcoin (only the PoW digest differs, Scrypt); no share format, coinbase commitment, or PPLNS math touched -> p2pool-merged-v36 surface NONE. +3 KATs pin the three-way ladder dispatch by job targets (23/23). Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
frstrtr
added a commit
that referenced
this pull request
Jun 23, 2026
…B) (#295) mining_submit (work_source.cpp:292) classifies a Scrypt submission three ways; the won-block outcome already dispatches via SubmitBlockFn, but the share-difficulty outcome -- "pow_hash <= share target -> record share in tracker" -- had no seam. This adds the producer half of the worker->mint run-loop standup, parallel to SubmitBlockFn: - MintShareInputs: raw-bytes found-share fields (header, coinbase, subsidy, prev_share/tip, merkle_branches, payout_script, segwit), decoupled from share/BlockType serialization like SubmitBlockFn. - MintShareFn + set_mint_share_fn(): the callback main_dgb.cpp binds to mint_local_share_with_ratchet (run_loop_mint.hpp) -> create_local_share, where the AutoRatchet chooses the {mint,vote} version pair. Mirrors the set_best_share_hash_fn idiom (empty until wired). - try_mint_share(): thread-safe dispatch (copies fn under lock); when unbound, logs loudly and returns a NULL hash -- no silent drop. No behavior change: the 4a mining_submit stub still rejects every submission and never reaches the seam (the classify branch lands in 4d). +3 KATs (forward+pass-through, empty-until-wired no-silent-drop, stub does-not-reach), dgb_work_source_test 20/20. Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
frstrtr
added a commit
that referenced
this pull request
Jun 23, 2026
…ssify->dispatch) [#82 leg-2 / Stage 4d] (#297) Replace the Stage-4a mining_submit stub with the live hot path. Reconstruct the 80-byte DGB block header from the JobSnapshot + miner inputs (coinbase = coinb1||en1||en2||coinb2; merkle ascent from the coinbase txid; header = version|prev|merkle|ntime|nbits|nonce, all little-endian / prevhash reversed to internal order), run the DGB-Scrypt PoW digest through the #286 scrypt_pow SSOT, expand both compact targets via compact_to_target, and classify via the Stage-4d submit_classify SSOT (tighten-first): WonBlock -> serialize the full block (BIP144 coinbase witness when segwit active) and hand it to the dual-path broadcaster submit_block_fn (P2P relay + submitblock RPC fallback, #82); scream-never-drop on a won block that reaches no sink. ShareAccept -> forward the found-share fields to try_mint_share (the #295 producer seam -> #294 mint bind); degrades to accepted-without- credit when no mint fn is wired (no silent drop). Reject -> stratum low-difficulty error. work_source.cpp / work_source_test.cpp only; per-coin isolation held. The header layout is byte-for-byte Bitcoin (only the PoW digest differs, Scrypt); no share format, coinbase commitment, or PPLNS math touched -> p2pool-merged-v36 surface NONE. +3 KATs pin the three-way ladder dispatch by job targets (23/23). Co-authored-by: frstrtr <frstrtr@users.noreply.github.com>
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.
Phase B pool/share, worker->mint run-loop standup — producer half.
What
mining_submit (work_source.cpp:292) classifies a Scrypt submission three ways. The won-block outcome already dispatches via SubmitBlockFn; the share-difficulty outcome — "pow_hash <= share target -> record share in tracker" — had no seam. This stands that seam up, parallel to SubmitBlockFn:
Why this is the next pillar
Only the won-block path existed. This is the producer half of the worker->mint standup; the consumer half (binding it to the ratchet helper + create_local_share) lands in main_dgb once the #294 helper is on master, and the live invocation point lands with stage 4d (real Scrypt classify in mining_submit).
Safety / scope
Tests
dgb_work_source_test 20/20 (17 prior + 3 new: forward+pass-through, empty-until-wired no-silent-drop, stub-does-not-reach). Test file already in the build.yml allowlist (no NOT_BUILT risk).