-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #950: [Consensus] Add locking on the chain index vector.
3cf8acf Add locking on the chain index vector. (Zannick) Pull request description: ### Problem tsan identified a data race on CChain, particularly concurrent access to the underlying vector's `operator[]`, `size`, and `resize` member functions. ### Solution Create a new lock `cs_vchain` and mark `vchain` as guarded by it, and ensure that the lock is taken prior to any use. For the `operator==` member function, grab both the locks in a prescribed order to avoid a deadlock. ### Tested Configured with --with-sanitizers=tsan, built with clang, run on regtest with 2 SHA mining threads enabled. Tree-SHA512: eac3c382c0afb8107865dbe041e8a0991e976cbccd602a80925d0fb1cc3c3d4e758c7a97605a7ba14547c420042d00ff7ba0744d20d28dc77b5928eade41b517
- Loading branch information
Showing
2 changed files
with
13 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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