Skip to content

fix(wallet): serialize mixing-only lock state - #7607

Merged
PastaPastaPasta merged 1 commit into
dashpay:developfrom
PastaPastaPasta:fix/wallet-mixing-lock-synchronization
Aug 13, 2026
Merged

fix(wallet): serialize mixing-only lock state#7607
PastaPastaPasta merged 1 commit into
dashpay:developfrom
PastaPastaPasta:fix/wallet-mixing-lock-synchronization

Conversation

@PastaPastaPasta

@PastaPastaPasta PastaPastaPasta commented Aug 13, 2026

Copy link
Copy Markdown
Member

Issue being fixed or feature implemented

CWallet::Lock(true) updated the mixing-only lock flag without holding cs_wallet, while Unlock() updated the same flag under the mutex. IsLocked() could also read the flag before acquiring the mutex. Concurrent wallet lock transitions could therefore race and expose an inconsistent lock state.

What was done?

  • Guard fOnlyMixingAllowed with cs_wallet and annotate that invariant.
  • Serialize both reads and all lock transitions through the wallet mutex.

No release note is included because this is an internal synchronization fix with no interface or workflow change.

How Has This Been Tested?

Built on Apple Silicon with the depends toolchain using --without-gui --disable-bench, then ran:

  • make -j13
  • ./src/test/test_dash --run_test=wallet_tests --log_level=message
  • test/lint/all-lint.py
  • git clang-format --diff upstream/develop -- src/wallet/wallet.cpp src/wallet/wallet.h

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 (not applicable; guarded by Clang thread-safety analysis)
  • I have made corresponding changes to the documentation (not applicable)
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

This pull request was created by Codex.

@thepastaclaw

thepastaclaw commented Aug 13, 2026

Copy link
Copy Markdown

🕓 Ready for review — 12 ahead in queue (commit 956e1e0)
Queue position: 13/13

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 01d7ac8d-f288-4c72-9f08-bd4222c6a79a

📥 Commits

Reviewing files that changed from the base of the PR and between b3e5295 and 46dfad3.

📒 Files selected for processing (3)
  • src/wallet/test/wallet_tests.cpp
  • src/wallet/wallet.cpp
  • src/wallet/wallet.h

Walkthrough

CWallet::IsLocked now acquires cs_wallet before checking mixing-only access. CWallet::Lock performs key cleansing and updates fOnlyMixingAllowed within the same lock scope. The wallet state declaration now marks fOnlyMixingAllowed as guarded by cs_wallet. A concurrency test verifies blocking and mixing-only lock behavior.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Mergeability Score: ⚪ Minimal · up to 46dfa

The change serializes wallet mixing-only lock state reads and transitions and adds focused concurrency coverage; no actionable merge-blocking risk remains after normal checks.

Possibly related PRs

Suggested reviewers: knst

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: synchronizing the wallet’s mixing-only lock state.
Description check ✅ Passed The description directly explains the synchronization issue, the implemented mutex changes, and the related regression test.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@PastaPastaPasta
PastaPastaPasta force-pushed the fix/wallet-mixing-lock-synchronization branch from 46dfad3 to 956e1e0 Compare August 13, 2026 19:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 956e1e01ed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/wallet/wallet.cpp
@PastaPastaPasta
PastaPastaPasta force-pushed the fix/wallet-mixing-lock-synchronization branch 2 times, most recently from df1ae79 to 956e1e0 Compare August 13, 2026 19:32
@PastaPastaPasta
PastaPastaPasta merged commit c42c883 into dashpay:develop Aug 13, 2026
37 of 41 checks passed
@PastaPastaPasta
PastaPastaPasta deleted the fix/wallet-mixing-lock-synchronization branch August 13, 2026 19:39
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.

2 participants