Skip to content

dash(stratum): explicit template-cache invalidate on coin-P2P tip event — close stale-payee window under future io-decouple#796

Merged
frstrtr merged 1 commit into
masterfrom
dash/coinp2p-tip-invalidate
Jul 21, 2026
Merged

dash(stratum): explicit template-cache invalidate on coin-P2P tip event — close stale-payee window under future io-decouple#796
frstrtr merged 1 commit into
masterfrom
dash/coinp2p-tip-invalidate

Conversation

@frstrtr

@frstrtr frstrtr commented Jul 21, 2026

Copy link
Copy Markdown
Owner

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's on_tip_changed handler (main_dash.cpp) does only bump_work_generation() + notify_all(). The fresh-payee GBT re-source happens only implicitly: the coin-P2P arm has no refresh_executor_, so cached_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_changed handler now calls ws->invalidate_template_cache() alongside bump_work_generation() + notify_all() — mirroring the #770/#772 fire_refresh trio (invalidate + bump + notify). The invalidate drops the cache, so the next served job is re-sourced with the fresh-tip payee regardless of refresh_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 — no build.yml change)

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 with refresh_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_source 40 → 42 green; c2pool-dash builds+links.

Draft — for a v0.2.4.1 hotel binary; the staged v0.2.4 deploys meanwhile.

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
frstrtr force-pushed the dash/coinp2p-tip-invalidate branch from a29ecaf to 8a1f479 Compare July 21, 2026 11:42
…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
frstrtr force-pushed the dash/coinp2p-tip-invalidate branch from 8a1f479 to 953d35b Compare July 21, 2026 12:07
@frstrtr
frstrtr marked this pull request as ready for review July 21, 2026 13:23
@frstrtr
frstrtr merged commit b82c982 into master Jul 21, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant