From 9938f4438dce6700afd58d33af9dc5ed65a2f4d0 Mon Sep 17 00:00:00 2001 From: Kittywhiskers Van Gogh <63189531+kwvg@users.noreply.github.com> Date: Mon, 26 Jul 2021 00:26:55 +0200 Subject: [PATCH] partial bitcoin#22550: improve `test_signing_with_{csv,cltv}` subtests partial: - 746f203f (only changes in test_framework/util.py) --- test/functional/test_framework/util.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/functional/test_framework/util.py b/test/functional/test_framework/util.py index 3577e98a20..f2c9448f8e 100644 --- a/test/functional/test_framework/util.py +++ b/test/functional/test_framework/util.py @@ -624,6 +624,17 @@ def mine_large_block(node, utxos=None): node.generate(1) +def generate_to_height(node, target_height): + """Generates blocks until a given target block height has been reached. + To prevent timeouts, only up to 200 blocks are generated per RPC call. + Can be used to activate certain soft-forks (e.g. CSV, CLTV).""" + current_height = node.getblockcount() + while current_height < target_height: + nblocks = min(200, target_height - current_height) + current_height += len(node.generate(nblocks)) + assert_equal(node.getblockcount(), target_height) + + def find_vout_for_address(node, txid, addr): """ Locate the vout index of the given transaction sending to the