bch(g2): coinbase-author KAT + slice-d pool-serve hot path - #553
Merged
Conversation
frstrtr
force-pushed
the
bch/g2-work-source
branch
3 times, most recently
from
July 1, 2026 17:11
55590c0 to
eb3a438
Compare
…ol-merged-v36 The oracle (data.py ~945) fires the subsidy/200 finder fee only in the not-v36_active branch; the v36 gentx pays no finder fee (pure PPLNS accounting). The BCH v36 coinbase builder was deducting subsidy/200 from the donation output and crediting the miner -- a payout-value divergence from the canonical merged-v36 gentx. Byte-parity is the HARD invariant, so the sv>=36 path now deducts nothing. Pre-v36 (v35) finder fee remains in the legacy not-v36 path, untouched. Consensus-bearing (moves payout values) -- merge stays operator-gated. BCH-only scope: src/impl/bch/stratum/work_source.cpp. No core, no bitcoin_family. Syntax-clean. Branch-only on bch/g2-work-source.
…acle
Extract the oracle-conforming coinbase OUTPUT-ASSEMBLY (donation forced last,
>=1-sat marker rule, amount-asc/script-asc sort, dests[-4000:] cap) out of
BCHWorkSource::build_connection_coinbase into the pure header-only
assemble_v36_coinbase_outputs(), so the byte-shape is pinned against the
p2pool-merged-v36 oracle (data.py generate_transaction v36 branch) rather than
asserted against the builder itself.
coinbase_author_kat_test (3 cases, ground-truth from scripts/gen_g2_oracle.py,
a verbatim transcription of the data.py v36 amounts/dests/payouts block):
1. ordering: amount-asc with a B==C tie exercising the script-asc tiebreak,
donation marker forced last, <1-sat marker decrement of the largest.
2. donation forced last even when its amount ties the largest PPLNS payout.
3. finder-fee removal byte-diff: assembled bytes equal the oracle v36 gentx
and differ from the pre-v36 199/200-haircut + subsidy/200 finder-fee
control -- proving the fee was removed, not self-authored.
Wired into the pure BCH_ABLA_TESTS CMake list and BOTH build.yml COIN_BCH
allowlists (no NOT_BUILT green-by-omission). per-coin isolation: src/impl/bch
only; zero p2pool-merged-v36 surface.
Close the M5 served-IWorkSource gap (slice-b criterion 1): standup_pool_run now constructs bch::stratum::BCHWorkSource off the embedded daemon HeaderChain + Mempool and stands up core::StratumServer on the miner-facing bind. A mainnet-hit (share-author) block routes through the SAME dual-path broadcaster (embedded P2P primary + BCHN submitblock fallback) as the won-block sink, via daemon.broadcast_won_block(block_bytes, HexStr(block_bytes)) returning r.any() -- so the genuine share coinbase is what reaches the network, not a synthetic solo-cb leg-C block. stratum_port==0 disables the front-end (daemon-only run-loop preserved). Header syntax-clean. src/impl/bch only; p2pool-merged-v36 surface NONE (run-loop bring-up + block dispatch, not share/PPLNS/coinbase bytes). BCH = SHA256d standalone parent, no-segwit, CashTokens transparent-carry.
First non-harness c2pool-bch entrypoint. --pool stands up the BCH pool node + embedded coin daemon via bch::standup_pool_run (the prior 0-caller production standup), binding the dual-path won-block sink and, with --stratum [HOST:]PORT, the miner-facing BCHWorkSource + StratumServer so a genuine share-author coinbase is what gets assembled and broadcast. Config built without a YAML load (matches --ibd harness): P2P magic (mainnet/testnet/regtest), BCHN peer, and sharechain PREFIX set by hand from chainparams. External BCHN-RPC fallback retained. --regtest/--anchor added; banner + arg dispatch wired. Structural slice (criterion 1): gives standup_pool_run its first caller. FOUND->ASSEMBLED->ACCEPTED e2e on fresh-genesis regtest is the next behavioural slice. bch-fenced (src only), p2pool-merged-v36 surface NONE.
--pool --regtest previously collapsed to testnet params (anchor@955700, P2P->.110) and served unwinnable testnet difficulty, so a single CPU could never win a block. Thread regtest as a third net distinct from mainnet/testnet: - asert.hpp: asert_regtest() + bch_pow_limit_regtest() (fPowNoRetargeting, fixed target at powLimit nBits 0x207fffff; ASERT bypassed on regtest) - header_chain.hpp: BCHChainParams::regtest() (P2P 18444, cold-start tip seeded so served nbits == 0x207fffff before first P2P regtest block) - embedded_daemon.hpp / pool_entrypoint.hpp / main_bch.cpp: is_regtest dispatch threaded through the --pool entrypoint GBT-from-local-regtest-BCHN (regtest_block::build_from_gbt) deferred to a follow-on sub-slice. Consensus-neutral: regtest-only behavior, no mainnet path change. Fenced to src/impl/bch/ + main_bch.cpp dispatch.
frstrtr
force-pushed
the
bch/g2-work-source
branch
from
July 2, 2026 07:46
eb3a438 to
a121045
Compare
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.
G2 BCH pool-serve build-out. Merge operator-gated — do NOT auto-merge (consensus-bearing payout values).
Head @1ac084a60 — coinbase-author KAT (this slice)
Pins the v36 coinbase OUTPUT-ASSEMBLY byte-for-byte against the p2pool-merged-v36 oracle.
build_connection_coinbaseinto pure headercoinbase_outputs.hpp::assemble_v36_coinbase_outputs()so the KAT exercises the shipping code, not a parallel impl.coinbase_author_kat_test— 3 cases, ground-truth fromscripts/gen_g2_oracle.py(verbatim transcription of data.py:920-1085 v36 amounts/dests/payouts):Underlying slices (already on branch)
Local: KAT 3/3 PASS;
work_source.cpp-fsyntax-only RC=0. per-coin isolation: src/impl/bch only; zero p2pool-merged-v36 surface.