Skip to content

Commit fa46768

Browse files
author
MarcoFalke
committed
test: Remove unused and confusing main parameter from script_util
Bitcoin script opcodes are equal on all chains (main and test) anyway. Can be reviewed with "--word-diff-regex=.".
1 parent a9d0cec commit fa46768

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

test/functional/test_framework/script_util.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,47 +25,47 @@
2525
DUMMY_P2WPKH_SCRIPT = CScript([b'a' * 21])
2626
DUMMY_2_P2WPKH_SCRIPT = CScript([b'b' * 21])
2727

28-
def keyhash_to_p2pkh_script(hash, main = False):
28+
def keyhash_to_p2pkh_script(hash):
2929
assert len(hash) == 20
3030
return CScript([OP_DUP, OP_HASH160, hash, OP_EQUALVERIFY, OP_CHECKSIG])
3131

32-
def scripthash_to_p2sh_script(hash, main = False):
32+
def scripthash_to_p2sh_script(hash):
3333
assert len(hash) == 20
3434
return CScript([OP_HASH160, hash, OP_EQUAL])
3535

36-
def key_to_p2pkh_script(key, main = False):
36+
def key_to_p2pkh_script(key):
3737
key = check_key(key)
38-
return keyhash_to_p2pkh_script(hash160(key), main)
38+
return keyhash_to_p2pkh_script(hash160(key))
3939

40-
def script_to_p2sh_script(script, main = False):
40+
def script_to_p2sh_script(script):
4141
script = check_script(script)
42-
return scripthash_to_p2sh_script(hash160(script), main)
42+
return scripthash_to_p2sh_script(hash160(script))
4343

44-
def key_to_p2sh_p2wpkh_script(key, main = False):
44+
def key_to_p2sh_p2wpkh_script(key):
4545
key = check_key(key)
4646
p2shscript = CScript([OP_0, hash160(key)])
47-
return script_to_p2sh_script(p2shscript, main)
47+
return script_to_p2sh_script(p2shscript)
4848

49-
def program_to_witness_script(version, program, main = False):
49+
def program_to_witness_script(version, program):
5050
if isinstance(program, str):
5151
program = bytes.fromhex(program)
5252
assert 0 <= version <= 16
5353
assert 2 <= len(program) <= 40
5454
assert version > 0 or len(program) in [20, 32]
5555
return CScript([version, program])
5656

57-
def script_to_p2wsh_script(script, main = False):
57+
def script_to_p2wsh_script(script):
5858
script = check_script(script)
59-
return program_to_witness_script(0, sha256(script), main)
59+
return program_to_witness_script(0, sha256(script))
6060

61-
def key_to_p2wpkh_script(key, main = False):
61+
def key_to_p2wpkh_script(key):
6262
key = check_key(key)
63-
return program_to_witness_script(0, hash160(key), main)
63+
return program_to_witness_script(0, hash160(key))
6464

65-
def script_to_p2sh_p2wsh_script(script, main = False):
65+
def script_to_p2sh_p2wsh_script(script):
6666
script = check_script(script)
6767
p2shscript = CScript([OP_0, sha256(script)])
68-
return script_to_p2sh_script(p2shscript, main)
68+
return script_to_p2sh_script(p2shscript)
6969

7070
def check_key(key):
7171
if isinstance(key, str):

0 commit comments

Comments
 (0)