Skip to content

dash(s8): live-wire MnStateMachine::apply_block via on_block_connected - #675

Merged
frstrtr merged 1 commit into
masterfrom
dash/s8-mn-state-live-wire
Jul 12, 2026
Merged

dash(s8): live-wire MnStateMachine::apply_block via on_block_connected#675
frstrtr merged 1 commit into
masterfrom
dash/s8-mn-state-live-wire

Conversation

@frstrtr

@frstrtr frstrtr commented Jul 12, 2026

Copy link
Copy Markdown
Owner

Scope: src/impl/dash/ only — single-coin, additive

Base SHA: 48e93de4 (master tip = #674 merge commit).

What

Wires the S8 mn_state_machine leaf into the live path. MnStateMachine::apply_block (RebuildListFromBlock semantics, 668 LOC, KAT test_dash_mn_state — both already on master) previously had no live caller outside its own KAT. The DMN set was populated ONLY by the bulk mnlistdiff snapshot (on_mn_list_update -> mnstates().load()).

CoinStateMaintainer::on_block_connected(block, height) now folds each connected block's special txs into the set incrementally, keeping the masternode payee the embedded coinbase pays current between full snapshots.

Invariants preserved

  • Bulk mnlistdiff snapshot path unchanged — stays the authoritative resync.
  • MN-readiness refreshed from post-apply size(): a block that empties the set (all collateral spent) drops the bundle to the dashd RPC fallback rather than backing a phantom payee. External-daemon fallback preserved (hard V36 requirement).
  • Per-coin isolation holds — no bitcoin_family/ or core/ touch. No build.yml change (target already in both allowlists).

Test

test_dash_coin_state_maintainer +2 KATs (no-op block preserves readiness; collateral-spend empties set -> DashdFallback). Local: 6/6 green, built --target test_dash_coin_state_maintainer, ctest from build/.

Oracle: apply_block semantics conform to frstrtr/p2pool-dash-derived MnStateMachine (dashcore specialtxman.cpp::RebuildListFromBlock), unchanged here.

…er::on_block_connected

Drive the DMN state machine incrementally per connected block. Prior to
this the masternode set was populated ONLY by the bulk mnlistdiff snapshot
(on_mn_list_update -> mnstates().load()); MnStateMachine::apply_block had
no live caller outside its KAT. on_block_connected() folds each connected
block s special txs into the set (RebuildListFromBlock semantics), keeping
the payee the embedded coinbase pays current BETWEEN full snapshots.

The bulk snapshot path is unchanged and stays the authoritative resync.
MN-readiness is refreshed from the post-apply size: a block that empties
the set (all collateral spent) drops the bundle to the dashd RPC fallback
rather than backing a template with a phantom payee -- the external-daemon
fallback path is preserved (hard V36 requirement).

Scope: src/impl/dash/ only, single-coin, additive.
KAT: test_dash_coin_state_maintainer +2 (no-op block preserves readiness;
collateral-spend empties set -> DashdFallback); 6/6 green.
@frstrtr
frstrtr merged commit d179214 into master Jul 12, 2026
26 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