test: introduce script_util helper for creating P2PK scripts

This commit is contained in:
Sebastian Falbesoner committed 2021-09-29 14:09:14 +02:00
1 parent d648bbb0a7
commit 429b49378e
7 files changed
+26 -17

No files matched your search

+2 -2
View File
@@ -33,11 +33,11 @@ from .script import (
CScriptOp,
OP_1,
OP_CHECKMULTISIG,
OP_CHECKSIG,
OP_RETURN,
OP_TRUE,
)
from .script_util import (
key_to_p2pk_script,
key_to_p2wpkh_script,
script_to_p2wsh_script,
)
@@ -134,7 +134,7 @@ def create_coinbase(height, pubkey=None, extra_output_script=None, fees=0, nValu
coinbaseoutput.nValue >>= halvings
coinbaseoutput.nValue += fees
if pubkey is not None:
coinbaseoutput.scriptPubKey = CScript([pubkey, OP_CHECKSIG])
coinbaseoutput.scriptPubKey = key_to_p2pk_script(pubkey)
else:
coinbaseoutput.scriptPubKey = CScript([OP_TRUE])
coinbase.vout = [coinbaseoutput]