In the test p2p_segwit.py, there are many instances where we send a segwit block to a node with the expectation that it is rejected. For this purpose, the helper function test_witness_block exists which allows also to check for a specific reject reason that is asserted in the debug log:
https://github.com/bitcoin/bitcoin/blob/502d22ceed1f90ed41336260f8eb428d3acaf514/test/functional/p2p_segwit.py#L119-L120
This PR aims to increase the precision of the tests by adding the expected reject reasons to all test_witness_block call instances (found via greping after test_witness_block(.*accepted=False). For some blocks that are rejected due to failed script verification, the exact reason is only shown in the debug log if parallel script verification is disabled. For this reason, the addition of the reasons is split up in two commits:
- first, all instances are tackled that are not subject to script verification, i.e. it doesn't matter whether parallel script verification is enabled or not (e.g.
bad-blk-weight,bad-witness-merkle-match...) - then, we explicitely set
-par=1to only use one script thread, and add the remaining reasons (non-mandatory-script-verify-flagwith the more specific reason in parantheses)