dgb: per-job template-retention seam — captured_template_txs_fn provider (#271) - #300
Merged
Merged
Conversation
…der (#271) The won-block reconstructor frames the broadcast block as [gentx] ++ other_txs, where other_txs is the captured-GBT template the won share was mined against. The into that seam but defers the provider itself to the run-loop. main_dgb installs an interim mempool RE-SELECTION lambda, merkle-consistent ONLY while the mempool is static across the won window (regtest); in prod any mempool mutation between job hand-out and won-block diverges the set -> wrong merkle root -> daemon-rejected block -> lost reward. coin/template_capture.hpp removes that race: TemplateCapture retains each handed-out template transactions[] keyed by the resulting share_hash and replays it verbatim at won-block. provider() yields the captured_template_txs_fn make_template_other_txs_fn consumes. Miss -> empty array -> a VALID coinbase-only block (the reconstructor empty contract), NOT fail-closed: a missing template must not forfeit the subsidy. Bounded FIFO so memory is O(capacity), not O(jobs). Thread-safe (capture on the job/mint path, provide on the COMPUTE thread inside the closure). dgb_template_capture_test (5/5): capture->provide json round-trip; miss replays empty; composed through the #299 bridge a HIT decodes byte-faithfully to the MutableTransaction vector deserialize_template_other_txs yields directly and a MISS to empty; overwrite- same-hash keeps one entry; FIFO eviction drops the oldest. Stacks on #299. Fenced to src/impl/dgb/; no p2pool-merged-v36 surface. Both build.yml allowlists updated (#143).
frstrtr
force-pushed
the
dgb/template-capture-provider
branch
from
June 21, 2026 18:49
3809439 to
b4126e8
Compare
frstrtr
added a commit
that referenced
this pull request
Jun 21, 2026
Fail-closed regtest soak proving a won block carrying a non-coinbase funded legacy tx is reconstructed (#300/#302/#303) and ACCEPTED by a peer down BOTH arms (P2P primary + submitblock isolated). Asserts NTX>=2 and funded-txid presence per arm via getrawmempool/getblock; die() aborts on any miss (no getrawtransaction-without-txindex false-green path).
frstrtr
added a commit
that referenced
this pull request
Jun 23, 2026
dgb: per-job template-retention seam — captured_template_txs_fn provider (#271)
frstrtr
added a commit
that referenced
this pull request
Jun 23, 2026
Replace the interim coinbase-only template_other_txs_fn stub in the #82 forced-won live seam with the production capture->bridge path: - declare a run-loop-scoped dgb::coin::TemplateCapture (#300/#271) that outlives every tracker callback the provider() is installed into - feed it through make_template_other_txs_fn (#299) as the reconstruct closure template_other_txs_fn, so a won block replays the EXACT non-coinbase set the share committed to (merkle-consistent) instead of reconstructing coinbase-only - seed_forced_from_gbt captures the node-B GBT transactions[] keyed by the forced share hash; coinbasevalue already includes those fees so the regenerated gentx subsidy stays balanced A capture MISS still decodes to an empty set -> a valid coinbase-only block (never fail-closed). Per-coin: src/impl/dgb + main_dgb only.
frstrtr
added a commit
that referenced
this pull request
Jun 23, 2026
Fail-closed regtest soak proving a won block carrying a non-coinbase funded legacy tx is reconstructed (#300/#302/#303) and ACCEPTED by a peer down BOTH arms (P2P primary + submitblock isolated). Asserts NTX>=2 and funded-txid presence per arm via getrawmempool/getblock; die() aborts on any miss (no getrawtransaction-without-txindex false-green path).
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.
Stacks on #299. Production replacement for main_dgb interim mempool re-selection lambda (merkle-consistent only on a static mempool). TemplateCapture retains each handed-out template transactions[] keyed by share_hash, replays it verbatim at won-block via provider() -> the captured_template_txs_fn the #299 make_template_other_txs_fn bridge consumes. Miss -> empty array -> valid coinbase-only block (never forfeit subsidy). Bounded FIFO, thread-safe. dgb_template_capture_test 5/5 local. Fenced to src/impl/dgb/; no p2pool-merged-v36 surface; both build.yml allowlists updated. HOLD merge (operator tap).