test: introduce generate_to_height helper, use in rpc_signrawtransaction

This will speed up the test a bit and avoid potential .generate() RPC
timeouts (in sub-test `test_signing_with_cltv()`) on slower machines.
This commit is contained in:
Sebastian Falbesoner
2021-07-26 00:26:55 +02:00
parent e3237b1cd0
commit 746f203f19
2 changed files with 14 additions and 2 deletions

View File

@ -15,6 +15,7 @@ from test_framework.util import (
assert_equal,
assert_raises_rpc_error,
find_vout_for_address,
generate_to_height,
hex_str_to_bytes,
)
from test_framework.messages import (
@ -270,7 +271,7 @@ class SignRawTransactionsTest(BitcoinTestFramework):
getcontext().prec = 8
# Make sure CSV is active
self.nodes[0].generate(500)
generate_to_height(self.nodes[0], 500)
assert self.nodes[0].getblockchaininfo()['softforks']['csv']['active']
# Create a P2WSH script with CSV
@ -306,7 +307,7 @@ class SignRawTransactionsTest(BitcoinTestFramework):
getcontext().prec = 8
# Make sure CLTV is active
self.nodes[0].generate(1500)
generate_to_height(self.nodes[0], 1500)
assert self.nodes[0].getblockchaininfo()['softforks']['bip65']['active']
# Create a P2WSH script with CLTV