test: introduce script_util helper for creating P2PK scripts

This commit is contained in:
Sebastian Falbesoner
2021-09-28 13:37:46 +02:00
parent d648bbb0a7
commit 429b49378e
7 changed files with 26 additions and 17 deletions

View File

@ -72,6 +72,7 @@ from test_framework.script import (
hash160,
)
from test_framework.script_util import (
key_to_p2pk_script,
key_to_p2wpkh_script,
keyhash_to_p2pkh_script,
script_to_p2sh_script,
@ -1455,7 +1456,7 @@ class SegWitTest(BitcoinTestFramework):
# Now try to spend it. Send it to a P2WSH output, which we'll
# use in the next test.
witness_script = CScript([pubkey, CScriptOp(OP_CHECKSIG)])
witness_script = key_to_p2pk_script(pubkey)
script_wsh = script_to_p2wsh_script(witness_script)
tx2 = CTransaction()
@ -1533,7 +1534,7 @@ class SegWitTest(BitcoinTestFramework):
key.generate()
pubkey = key.get_pubkey().get_bytes()
witness_script = CScript([pubkey, CScriptOp(OP_CHECKSIG)])
witness_script = key_to_p2pk_script(pubkey)
script_pubkey = script_to_p2wsh_script(witness_script)
# First create a witness output for use in the tests.