underfill: port near-empty-template guard to DGB, BTC, BCH (+ KATs)#728
Merged
Conversation
Port the v36 template-underfill guard (near-empty template on a non-empty
fee-paying mempool, LOG-ONLY WARNING) from LTC/DOGE to the three coins that
were missing it, in the DASH free-predicate form (underfill_guard_trips +
50 kB UNDERFILL_MIN_FILL_BYTES / UNDERFILL_BACKLOG_SLACK pins):
- btc: guard inside TemplateBuilder::build_template (template_builder.hpp),
SAFE-ADDITIVE trailing bool* underfill_tripped seam; GBT JSON untouched.
- bch: same, after the CTOR re-sort; ABLA budget / sizelimit untouched.
- dgb: build_work_template() is a pure shaper with no mempool access, so the
guard evaluates in make_mempool_tx_source (embedded_tx_select.cpp) — the
one mempool-visible point feeding BOTH template callers (stratum
DGBWorkSource + EmbeddedCoinNode); predicate/thresholds pinned in
coin/template_builder.hpp.
KATs per coin (test/test_{btc,dgb,bch}_underfill_guard.cpp, mirroring
test_dash_underfill_guard.cpp): threshold pins, boundary strictness,
empty/fee-unknown/drained no-trip, and real-build wiring via the seam
(stale-input-guard-emptied selection over a fee-paying backlog).
Registered in test/CMakeLists.txt (bch entry gated on COIN_BCH like
bch_coin). New targets still need the build.yml --target allowlist
(main leg: btc+dgb; BCH leg: bch) or CTest shows the NOT_BUILT sentinel.
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.
Completes the block-underfill guard across all coins — it was on LTC/DOGE/DASH, now DGB/BTC/BCH. Mirrors the LTC/DOGE guard (50kB fill pins; near-empty template + non-empty fee-paying mempool backlog => LOG_WARNING, log-only, empty mempools never trip).
Not compile-checked by author (no toolchain) — CI validates. The 3 new gtests need adding to the build.yml --target allowlists (workflow scope) or they show 'Not Run'. Follow-up: NMC's embedded template path (src/impl/nmc/coin/template_builder.hpp) also lacks the guard.