mempool, validation: Explain cs_main locking semantics
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
- Build with Clang in Debug mode:
CXX=clang++ CC=clang cmake .. -GNinja -DCMAKE_BUILD_TYPE=Debug ninja check-all
- Verify that the compiler has not emitted a thread-safety warning.
- Run the node: ./src/bitcoind -regtest
- Verify that text similar to "Assertion failed: lock ... not held ..." is not printed on stderr.
- 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