dash(stratum): explicit template-cache invalidate on coin-P2P tip event — close stale-payee window under future io-decouple#796
Merged
Conversation
frstrtr
added a commit
that referenced
this pull request
Jul 21, 2026
…t fresh-payee re-source (robustness for the stale-payee window; #796) Mirrors the fire_refresh trio (invalidate+bump+notify) so the served template always re-sources with the fresh-tip payee regardless of refresh_executor_ state. KATs in test_dash_stratum_work_source prove the window stays closed with refresh_executor_ set. Consensus-neutral.
frstrtr
force-pushed
the
dash/coinp2p-tip-invalidate
branch
from
July 21, 2026 11:42
a29ecaf to
8a1f479
Compare
…t fresh-payee re-source (robustness for the stale-payee window; #796) Mirrors the fire_refresh trio (invalidate+bump+notify) so the served template always re-sources with the fresh-tip payee regardless of refresh_executor_ state. KATs in test_dash_stratum_work_source prove the window stays closed with refresh_executor_ set. Consensus-neutral.
frstrtr
force-pushed
the
dash/coinp2p-tip-invalidate
branch
from
July 21, 2026 12:07
8a1f479 to
953d35b
Compare
frstrtr
marked this pull request as ready for review
July 21, 2026 13:23
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.
Fast-follow reward-safety hardening (v0.2.4.1). NOT blocking the current review-approved v0.2.4 hotel deploy — the stale-payee window closes correctly today; this makes it explicit + future-proof.
The latent gap (found in the ZMQ-rebase adversarial delta)
With
--coin-p2p-connect(the hotel config), the coin-P2P arm'son_tip_changedhandler (main_dash.cpp) does onlybump_work_generation()+notify_all(). The fresh-payee GBT re-source happens only implicitly: the coin-P2P arm has norefresh_executor_, socached_work()takes the legacy inline-blocking re-source path.If #781's io-decouple is ever extended to the coin-P2P arm,
refresh_executor_becomes set →cached_work()serves the STALE cached template (frozen masternode payee) while refreshing async → a stale-payee job goes out → the window reopens → lost blocks on a rotated payee.Fix
The coin-P2P
on_tip_changedhandler now callsws->invalidate_template_cache()alongsidebump_work_generation()+notify_all()— mirroring the #770/#772fire_refreshtrio (invalidate + bump + notify). The invalidate drops the cache, so the next served job is re-sourced with the fresh-tip payee regardless ofrefresh_executor_state; a set-gap (honest null) is served until the fresh template lands — never a stale-payee job.KATs (folded into the allowlisted
test_dash_stratum_work_source— nobuild.ymlchange)With a deferred
refresh_executor_(models the rpc_pool background thread) and the fallback rotated to a NEW tip/payee after the cache is primed:InvalidateClosesStalePayeeWindowUnderRefreshExecutor— after invalidate+bump the served job is never the stale tip-A template (set-gap, then fresh tip-B). The window stays closed withrefresh_executor_set.BumpAloneServesStaleUnderRefreshExecutor— the contrast: bump-only serves the STALE tip-A payee, proving the invalidate is what closes it.Consensus-neutral — notify/refresh timing only; no share/payout/target/payee-value change.
stratum_work_source40 → 42 green;c2pool-dashbuilds+links.Draft — for a v0.2.4.1 hotel binary; the staged v0.2.4 deploys meanwhile.