This PR primarily aims to solve the current RPC timeout problem for test rpc_signrawtransaction.py, as described in #22542. In the course of that the test is also improved in other ways (see #22542#pullrequestreview-714297804).
Reviewers guideline:
- In
test_signing_with_cltv(), a comment is fixed -- it wrongly referred to CSV, it should be CLTV. - As preparation, assertions are added that ensure that CSV and CLTV have been really activated after generating blocks by checking the 'softforks' output of the getblockchaininfo() RPC. Right now in master, one could remove (or decrease, like in #22542) the generate calls and the test would still pass, when it shouldn't.
- A helper
generate_to_height()is introduced which improves the previous way of reaching a block height in two ways:- instead of blindly generating TH blocks to reach target block height >= TH, the current block height CH is taken into account, and only (TH - CH) are generated in total
- to avoid potential RPC timeouts, the block generation is split up into multiple generatetoaddress RPC calls (as suggested by laanwj); here chunks of 200 blocks have been chosen
- The helper is used in the affected sub-tests, which should both speed-up the test (from ~18s to ~12s on my machine) and avoid potential timeouts
- Finally, the activation constants for CSV and CLTV are used instead of using magic numbers 500 and 1500
Open questions:
- Any good naming alternatives for
generate_to_height()? Not really happy with the name, happy to hear suggestions - Where to put the CSV and CLTV activation height constants in the test_framewor folder? I guess importing constants from other tests isn't really the desired way to go