Skip to content

fix: bind CoinJoin entry admission to session snapshot - #7599

Draft
PastaPastaPasta wants to merge 1 commit into
dashpay:developfrom
PastaPastaPasta:fix/coinjoin-entry-session-snapshot
Draft

fix: bind CoinJoin entry admission to session snapshot#7599
PastaPastaPasta wants to merge 1 commit into
dashpay:developfrom
PastaPastaPasta:fix/coinjoin-entry-session-snapshot

Conversation

@PastaPastaPasta

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

CoinJoin entry validation performs chain and mempool work outside the session lock. During that work, the active session can reset or advance, and another entry can consume the same capacity or input. The validated entry could then be appended using a different session denomination or stale admission state.

This is intentionally a draft until #7596 lands. That PR makes the queue-to-entry transition participate in the same lock; this branch will then be rebased before review.

What was done?

  • Snapshot the session ID and denomination before validating an entry.
  • Pass the captured denomination explicitly through shared input/output validation.
  • Revalidate the session, denomination, state, capacity, and input uniqueness while holding cs_coinjoin, then append the entry in the same critical section.
  • Only consume collateral if the validated session is still active and the collateral is registered to it.
  • Protect the DSVIN readiness read with the session lock.
  • Add a regression test proving validation uses the captured denomination rather than mutable live session state.

How Has This Been Tested?

  • Built test/test_dash with depends on macOS arm64 using --enable-debug --enable-werror.
  • Ran coinjoin_inouts_tests (9 cases), including the new session-denomination regression test.
  • Ran coinjoin_tests (12 cases).
  • Ran the whitespace and logging linters.
  • Performed an additional correctness, concurrency, regression, and security review pass; this added the stale-session collateral-consumption guard.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone

This pull request was created by Codex.

@PastaPastaPasta PastaPastaPasta changed the title fix(coinjoin): bind entry admission to session snapshot fix: bind CoinJoin entry admission to session snapshot Aug 13, 2026
@PastaPastaPasta
PastaPastaPasta force-pushed the fix/coinjoin-entry-session-snapshot branch from c03f5d3 to c9b90b6 Compare August 13, 2026 06:07
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