HomePhabricator

mempool, validation: Explain cs_main locking semantics

Description

mempool, validation: Explain cs_main locking semantics

Summary:
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
https://github.com/bitcoin/bitcoin/pull/14963

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
./src/bench/bitcoin-bench

Reviewers: Fabien, #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D4227

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Dec 14 2018, 21:28
fpelliccioniCommitted on Oct 9 2019, 17:21
fpelliccioniPushed on Oct 9 2019, 17:21
Reviewer
Restricted Project
Differential Revision
D4227: mempool, validation: Explain cs_main locking semantics
Parents
rABCcdddac09dfb4: [build-configurations] Make BUILD_DIR configurable
Branches
Unknown
Tags
Unknown