fix: coinjoin wallet manager lock order#7412
Closed
PastaPastaPasta wants to merge 1 commit into
Closed
Conversation
✅ No Merge Conflicts DetectedThis PR currently has no conflicts with other open PRs. |
PastaPastaPasta
force-pushed
the
codex/fix-coinjoin-lock-order
branch
from
July 7, 2026 16:53
5d5128b to
d1c1ddd
Compare
Collaborator
|
I refactored this part significantly: https://github.com/dashpay/dash/pull/7259/files |
5 tasks
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.
Issue being fixed or feature implemented
Fixes a debug lock-order assertion seen in CI when CoinJoin wallet-manager maintenance and wallet keypool/client lookup paths observe opposite lock orders.
The problematic cycle was:
CWallet::cs_wallet->cs_wallet_manager_mapcs_wallet_manager_map-> CoinJoin manager/session code ->CWallet::cs_walletThis can abort debug builds with a potential deadlock / inconsistent lock order assertion.
What was done?
std::shared_ptrownership instead ofstd::unique_ptr.cs_wallet_manager_mapto short-lived map/index operations: snapshot, lookup, insert, extract/erase, and destructor swap.cs_wallet_manager_map.CoinJoinClientImplhold ashared_ptrso returned interface clients cannot dangle after wallet removal.newkeypoolcallback path that stops CoinJoin mixing while holding the wallet lock.How Has This Been Tested?
Ran the checks available in this checkout:
git diff --check upstream/develop..HEADPYTHONPYCACHEPREFIX=/private/tmp/dash-pycache python3 -m py_compile test/functional/rpc_coinjoin.pyLOCK(cs_wallet_manager_map)andWITH_LOCK(cs_wallet_manager_map)to confirm remaining map locks only protect map swap/snapshot/lookup/insert/extract.Full unit/functional execution was not run locally because this checkout has no configured build tree or binaries (
Makefile,src/test/test_dash, andsrc/dashdare absent).Breaking Changes
None. This changes internal CoinJoin wallet-manager ownership/lifetime semantics only; there are no RPC, wallet-file, network, or user-facing API changes.
Checklist: