elements/test/functional/test_framework
Andrew Poelstra c0fda0cc05 Merge ddc0a600b3 into merged_master (Bitcoin PR #18617)
For reasons I do not really grok, this PR changes the timing behavior of the
functional tests to reliably expose a deadlock in the claimpegin RPC that has
existed since the 0.17 rebase.

The mechanism is: in `claimpegin` in src/wallet/rpcwallet.cpp:5873, we call
`AcceptToMemoryPoolWorker`. This requires cs_main to be locked, which it is
not (contrast Core's `testmempoolaccept` RPC, which similarly calls
`AcceptToMemoryPoolWorker` from the RPC thread, and locks cs_main immediately
before).

We do *say* that it is locked, in the `LockAssertion` one the line above, but
this was added in ad3d496d78 during the 0.17
rebase (PR #620), apparently to shut up some linter on OSX, and as near as I
can tell it was never true.

Anyway, `AcceptToMemoryPoolWorker` calls through a couple layers which assume
cs_main is locked, to `AcceptSingleTransaction`, which locks m_pool.cs on line
src/validation.cpp:1101. It then calls `PreChecks`, which on line 784 calls
::ChainActive(), which _actually_ locks cs_main, though only briefly. This
line is the deadlock, because we locked m_pool.cs followed by cs_main...

...meanwhile, in src/net_processing.cpp, we lock cs_main at the top of the
`PeerLogicValidation::SendMessages` loop (src/net_processing.cpp:3628). In the
same loop, in the `feefilter` message processing, we call CTxMemPool::GetMinFee
(src/net_processing.cpp:4137), which locks m_pool.cs. Deadlock.

Anyway, that explains the change to locking behavior that I added to an
otherwise test-only PR.
2020-11-26 01:08:36 +00:00
..
__init__.py Rename rpc-tests directory to functional 2017-03-20 10:40:31 -04:00
address.py Merge 54f812d9d2 into merged_master (Bitcoin PR #18673) 2020-11-26 01:08:23 +00:00
authproxy.py test: Try once more when RPC connection fails on Windows 2020-04-12 09:04:15 -04:00
blocktools.py Merge 62117f9f36 into merged_master (Bitcoin PR #16363) 2020-11-09 21:20:12 +00:00
coverage.py Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
descriptors.py Output a descriptor in createmultisig and addmultisigaddress 2020-01-30 23:55:36 -05:00
key.py Add a --descriptors option to various tests 2020-04-23 13:59:48 -04:00
liquid_addr.py fix len check in blech32 decode() in test framework 2019-09-13 20:24:23 +05:00
messages.py Merge fd48e7ad99 into merged_master (Bitcoin PR #18585) 2020-11-26 01:08:30 +00:00
mininode.py Merge ddc0a600b3 into merged_master (Bitcoin PR #18617) 2020-11-26 01:08:36 +00:00
netutil.py scripted-diff: Update copyright in ./test 2019-03-02 10:58:35 -05:00
script.py Merge a66ba6d029 into merged_master (Bitcoin PR #18576) 2020-11-26 01:08:35 +00:00
script_util.py test: Remove unused, undocumented and misleading CScript.__add__ 2020-04-22 09:00:56 -04:00
segwit_addr.py Use BIP173 addresses in segwit.py test 2017-09-28 17:29:01 -07:00
siphash.py Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
socks5.py scripted-diff: Update copyright in ./test 2019-03-02 10:58:35 -05:00
test_framework.py Merge ddc0a600b3 into merged_master (Bitcoin PR #18617) 2020-11-26 01:08:36 +00:00
test_node.py Merge ddc0a600b3 into merged_master (Bitcoin PR #18617) 2020-11-26 01:08:36 +00:00
test_shell.py TestShell: Return self from setup() 2019-11-05 12:55:52 +01:00
util.py Merge ddc0a600b3 into merged_master (Bitcoin PR #18617) 2020-11-26 01:08:36 +00:00
wallet_util.py Merge eef90c14ed into merged_master (Bitcoin PR #16528) 2020-11-26 01:08:31 +00:00