ltc(underfill): guard near-empty template on non-empty mempool (v36 cutover deploy gate)#663
Merged
Merged
Conversation
Net-new c2pool-side template-fill safety net for the v36 cutover deploy path. After tx selection at the pinned seam (template_builder.hpp), sum the wire bytes actually packed into the template and, if that fill is under UNDERFILL_MIN_FILL_BYTES (50 kB, the legacy p2pool near-empty floor) while the local mempool still holds fee-paying backlog exceeding UNDERFILL_BACKLOG_SLACK (50 kB) beyond what was selected, emit a loud WARNING for contabo-prod-watch / operator. Detects the near-empty-block- on-a-full-mempool regression that gates the cutover; genuinely empty mempools never trip it. Thresholds reviewable by btc-heap-opt/Director. NOT the byte-parity KAT axis — this is a threshold guard, not a byte-mirror. DOGE aux inherits via merged-mining.
DOGE runs its OWN embedded GBT template and selects its OWN transactions,
so it can produce a near-empty block on a non-empty DOGE mempool
independently of LTC. Merged-mining makes the aux inherit the parent PoW,
not the tx-fill, so the LTC parent guard does NOT cover this path — the
guard must live in the DOGE builder directly. This refines the earlier
LTC commit note ("DOGE aux inherits via merged-mining"): that is true
for work, not for template fill.
Byte-identical logic to the LTC guard (9e06ef6): after tx selection at
the pinned seam, sum wire bytes packed; if fill < UNDERFILL_MIN_FILL_BYTES
(50 kB legacy floor) while the DOGE mempool holds fee-paying backlog
> UNDERFILL_BACKLOG_SLACK beyond what was selected, emit a loud WARNING
for contabo-prod-watch / operator. Genuinely empty mempools never trip.
Thresholds are a bucket-2 v36-native shared structure (standardize
cross-coin). Completes the underfill-guard deploy-gate slice for LTC+DOGE.
Owner
Author
|
Added the DOGE-aux mirror (3af519f, GPG-signed): DOGE runs its own embedded GBT template and selects its own txs, so it can go near-empty on a non-empty DOGE mempool independently — merged-mining shares the parent PoW, not the tx-fill, so the LTC guard does not cover this path. Byte-identical guard logic, [EMB-DOGE] tag. PR #663 now delivers the underfill guard for LTC+DOGE together. |
frstrtr
added a commit
that referenced
this pull request
Jul 10, 2026
Close the underfill KAT axis that the DOA commit (346ee19) deferred pending the constant's canonical name+default. Per integrator [s=contabo-gate] 2026-07-10, the threshold already landed in #663: UNDERFILL_MIN_FILL_BYTES = 50000, an operational near-empty floor (not a consensus byte-parity constant). DOA is stats-only and unthresholded, so there was never a DOA threshold to wait on -- the two were conflated. Extract the underfill predicate + its pinned defaults out of the two inlined build_template() guards into core::underfill (SSOT header), so the live LTC parent path (src/impl/ltc/coin/template_builder.hpp build_template ~L271) and the DOGE embedded-aux path (src/impl/doge/coin/template_builder.hpp ~L140) and the KAT all assert on the SAME is_underfill() + MIN_FILL_BYTES/BACKLOG_SLACK -- not a re-implementation (non-hollow, mirrors the DOA is_doa_share() pattern). Both per-coin UNDERFILL_* constants now derive from the SSOT: bucket-2 v36-native shared-structure standardization, values unchanged (50000, semantics-preserving). KAT (core_test, gtest) pins the contract: MIN_FILL_BYTES/BACKLOG_SLACK == 50000 (static_assert + runtime); genuinely-empty and zero-fee-backlog mempools never trip; healthy full blocks never trip; near-empty-on-fee-paying-backlog trips; near-empty edge is strict < and backlog edge is strict >. 7/7 green, full core_test 68/68 (61 pre-DOA + 5 DOA + 7 underfill). Offline deterministic, gates the cutover build only (behind natural-vote, operator-gated cutover).
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.
Net-new c2pool-side underfill guard for the v36 contabo cutover deploy build (1 of the 2 gate ports; DOA-under-load is the other, still blocked on a portable fix-shape).
What
Single commit 9e06ef6 (GPG 50AB1379), +33 lines in src/impl/ltc/coin/template_builder.hpp. After tx selection at the pinned seam, sums wire bytes actually packed and, if fill < UNDERFILL_MIN_FILL_BYTES (50kB legacy p2pool near-empty floor) while the local mempool still holds fee-paying backlog > UNDERFILL_BACKLOG_SLACK (50kB) beyond what was selected, emits a loud WARNING for contabo-prod-watch/operator. Genuinely empty mempools never trip it.
What it is NOT
Scope / classification
Reviewer: dash-consensus-pay-replay. Merge: integrator (I do not merge).