HomePhabricator

refactor: Avoid locking tx pool cs thrice

Description

refactor: Avoid locking tx pool cs thrice

Summary:
addUnchecked is (outside the tests) only called by ATMP, which already takes the tx pool read lock. So locking it twice more in both addUnchecked methods seems redundant.

Backport of Bitcoin Core PR13786
https://github.com/bitcoin/bitcoin/pull/13786

Test Plan:

  1. Build with Clang in Debug mode:
CXX=clang++ CC=clang cmake .. -GNinja -DCMAKE_BUILD_TYPE=Debug
ninja check
  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.

Reviewers: Fabien, #bitcoin_abc, deadalnix

Reviewed By: Fabien, #bitcoin_abc, deadalnix

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

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Jul 28 2018, 15:09
fpelliccioniCommitted on Oct 3 2019, 13:43
deadalnixPushed on Oct 3 2019, 15:47
Reviewer
Restricted Project
Differential Revision
D4186: refactor: Avoid locking tx pool cs thrice
Parents
rSTAGINGa0dd249c1862: Return void instead of bool for functions that cannot fail
Branches
Unknown
Tags
Unknown