Page MenuHomePhabricator

mempool, validation: Explain cs_main locking semantics

Authored by fpelliccioni on Oct 8 2019, 19:09.



Both the chain state and the transaction pool are validation specific, but access to them is protected by two locks. The two locks have the following semantics:

Backport of Bitcoin Core PR14963

Test Plan
  1. Build with Clang in Debug mode:
CXX=clang++ CC=clang cmake .. -GNinja -DCMAKE_BUILD_TYPE=Debug
ninja check-all
  1. Verify that the compiler has not emitted a thread-safety warning.
  2. Run the node: ./src/bitcoind -regtest
  3. Verify that text similar to "Assertion failed: lock ... not held ..." is not printed on stderr.
  1. Run benchmarks:
cmake .. -GNinja
ninja bench-bitcoin

Diff Detail

rABC Bitcoin ABC
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

fpelliccioni created this revision.Oct 8 2019, 19:09
Herald added a reviewer: Restricted Project. · View Herald TranscriptOct 8 2019, 19:09
fpelliccioni edited the test plan for this revision. (Show Details)Oct 8 2019, 19:10
fpelliccioni planned changes to this revision.Oct 8 2019, 19:12

I don't know what happened with Squash... I lost some of the changes...

fpelliccioni updated this revision to Diff 13415.Oct 9 2019, 12:37
fpelliccioni edited the test plan for this revision. (Show Details)

fix squashing

deadalnix accepted this revision.Oct 9 2019, 12:44
This revision is now accepted and ready to land.Oct 9 2019, 12:44