dgb: emit GBT scaffold fields (version/curtime/mintime/transactions) in work template (Stage 4c) - #212
Merged
Merged
Conversation
…Stage 4c) get_current_work_template() now emits the next-block height and its coinbasevalue instead of an empty object. The coinbasevalue is derived through the #207 embedded SSOT (coinbase_value -> resolve_coinbase_value -> subsidy_func) keyed on next_block_height() (#209, == tip.height + 1; == base_height for an empty chain). Embedded path: no external-daemon GBT value is plumbed in yet and mempool-fee aggregation is unwired, so total_fees = 0; a present GBT coinbasevalue stays authoritative and fees add on top of subsidy in later slices without changing this SSOT call. The remaining GBT template fields (previousblockhash, bits, version, curtime, mintime, transactions[]) and the build_connection_coinbase gentx assembly land in following Stage 4c/4d slices. Test: +WorkTemplateEmitsHeightAndCoinbaseValueViaSsot pins height + coinbasevalue to the p2pool-dgb-scrypt oracle subsidy at the phase3 era boundary; existing stub-default assertion relaxed. dgb_work_source_test 14/14.
…in work template (Stage 4c)
get_current_work_template() now surfaces the GBT-shaped fields the embedded
path can derive TRUTHFULLY from current chain state, ahead of a full
dgb::coin::TemplateBuilder port (M3 TODO), alongside the existing height +
coinbasevalue:
version BIP9 base | DGB Scrypt algo nibble. A DGB template MUST pin the
Scrypt lane: the mining algo lives in 4 nVersion bits
(coin/dgb_block_algo.hpp SSOT) and Scrypt is the all-zero
codepoint (DGB_BLOCK_VERSION_SCRYPT == 0x0000). Any other nibble
is a non-Scrypt algo that is accept-by-continuity / V37, never a
template this V36 binary emits.
curtime current wall-clock; GBT's suggested header nTime.
mintime median_time_past()+1 (#209 accessor) = DGB Core
ContextualCheckBlockHeader lower bound (nTime > MTP). Empty chain
returns INT64_MIN (unconstrained) -> emitted as 0.
transactions empty array: embedded mempool tx SELECTION is unwired, so no
transactions are fabricated and fees stay 0 (consistent with the
total_fees=0 coinbasevalue).
Deliberately NOT emitted yet (need accessors the Scrypt-only HeaderSample does
not carry; following Stage 4c/4d slices):
previousblockhash tip block hash (HeaderSample stores no hash yet)
bits next-block compact target off the DigiShield retarget window
and the per-connection coinbase (gentx + ShareTracker ref_hash + PPLNS payout
map) assembles in build_connection_coinbase() -- consensus-bearing output that
surfaces for an operator tap, not in this field wire.
Test: +WorkTemplateEmitsGbtScaffoldFields pins version == 0x20000000, mintime
== 0 on an empty chain, curtime >= 0, transactions[] present-but-empty, and
asserts previousblockhash/bits remain absent. dgb_work_source_test 15/15.
Fenced to src/impl/dgb (2 files); no new gtest target, build.yml untouched.
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.
Stage 4c — GBT scaffold fields in
get_current_work_template()Builds on #211 (e2714b9, height+coinbasevalue wire). Surfaces the GBT-shaped fields the embedded path can derive truthfully from current chain state, ahead of a full
dgb::coin::TemplateBuilderport (M3 TODO):version0x20000000|DGB_BLOCK_VERSION_SCRYPT(0x0000)coin/dgb_block_algo.hppSSOTcurtimemintimemedian_time_past()+1(#209)nTime > MTPlower bound; empty chain → 0transactions[]Deliberately NOT emitted yet (need accessors the Scrypt-only
HeaderSampledoesn't carry; following slices):previousblockhash(tip block hash not stored),bits(next-target compact off the DigiShield window). The per-connection coinbase (gentx + ShareTracker ref_hash + PPLNS payout map) lands inbuild_connection_coinbase()— that output is consensus-bearing and surfaces for an operator tap, not this field wire.Scope
src/impl/dgb(2 files), no shared base touched.build.ymluntouched (ci: build test_dgb_subsidy in both Linux test jobs (fix master-red NOT_BUILT) #143 NOT_BUILT trap avoided).Test
dgb_work_source_test15/15 —+WorkTemplateEmitsGbtScaffoldFieldspinsversion==0x20000000,mintime==0(empty chain),curtime>=0,transactions[]present-but-empty, and assertspreviousblockhash/bitsremain absent.HOLD merge — integrator verifies the full CI rollup on the head SHA before landing.