Skip to content

dgb: per-job template-retention seam — captured_template_txs_fn provider (#271) - #300

Merged
frstrtr merged 1 commit into
masterfrom
dgb/template-capture-provider
Jun 21, 2026
Merged

dgb: per-job template-retention seam — captured_template_txs_fn provider (#271)#300
frstrtr merged 1 commit into
masterfrom
dgb/template-capture-provider

Conversation

@frstrtr

@frstrtr frstrtr commented Jun 21, 2026

Copy link
Copy Markdown
Owner

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).

@frstrtr
frstrtr changed the base branch from dgb/tx-inclusion-template-bridge to master June 21, 2026 18:48
…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
frstrtr force-pushed the dgb/template-capture-provider branch from 3809439 to b4126e8 Compare June 21, 2026 18:49
@frstrtr
frstrtr merged commit 6d3dbf6 into master Jun 21, 2026
10 checks passed
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).
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