This is an alternative to #32457 which replaces the current benchmark block 413567 from 2016 with block 784588 from 2023.
Added bench/block_generator.{h,cpp}
that builds a fully valid block at runtime and exposes a serialized and an in-memory block, so benchmarks can fetch whichever form they need:
- GetBlock()
- in-memory CBlock
;
- GetBlockData()
- serialized DataStream
.
- Generation is steered by
ScriptRecipe
:- per-type probabilities for legacy, P2SH, v0/v1 witness, anchor, multisig, OP_RETURN, non-standard, …
- a geometric base that controls input/output counts, witness-stack depth, amounts, versions, lock-times, sequences, …
Presets
kLegacy
(pre-SegWit) andkWitness
(Taproot-era) are included, callers can supply custom mixes.
- Deterministic
FastRandomContext
yields identical output on every run while avoiding repetition and predictability bias. - Blocks are mined against the easiest allowed target, then run through
CheckBlock()
to ensure full validity.
This delivers diverse, up-to-date test data without adding another megabyte-scale binary to the repository and lets us retune workloads as network patterns evolve.