aboutsummaryrefslogtreecommitdiff
path: root/test/functional/feature_segwit.py
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-06-27 23:03:40 +0200
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2021-06-28 20:14:07 +0200
commitb57b633b942da162045b1fe7743a8abdfeaf60e2 (patch)
treebddde7c25becb24afe070ef0a80e6d0c58a4ac26 /test/functional/feature_segwit.py
parent61b6a017a9f99ef072b2d1980dd547eb20093352 (diff)
downloadbitcoin-b57b633b942da162045b1fe7743a8abdfeaf60e2.tar.xz
test: use script_util helpers for creating P2PKH scripts
Diffstat (limited to 'test/functional/feature_segwit.py')
-rwxr-xr-xtest/functional/feature_segwit.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/functional/feature_segwit.py b/test/functional/feature_segwit.py
index 42910904d7..e3ec53c3d9 100755
--- a/test/functional/feature_segwit.py
+++ b/test/functional/feature_segwit.py
@@ -34,13 +34,14 @@ from test_framework.script import (
OP_CHECKMULTISIG,
OP_CHECKSIG,
OP_DROP,
- OP_DUP,
OP_EQUAL,
- OP_EQUALVERIFY,
OP_HASH160,
OP_TRUE,
hash160,
)
+from test_framework.script_util import (
+ key_to_p2pkh_script,
+)
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (
assert_equal,
@@ -427,7 +428,7 @@ class SegWitTest(BitcoinTestFramework):
op0 = CScript([OP_0])
# 2N7MGY19ti4KDMSzRfPAssP6Pxyuxoi6jLe is the P2SH(P2PKH) version of mjoE3sSrb8ByYEvgnC3Aox86u1CHnfJA4V
unsolvable_address_key = hex_str_to_bytes("02341AEC7587A51CDE5279E0630A531AEA2615A9F80B17E8D9376327BAEAA59E3D")
- unsolvablep2pkh = CScript([OP_DUP, OP_HASH160, hash160(unsolvable_address_key), OP_EQUALVERIFY, OP_CHECKSIG])
+ unsolvablep2pkh = key_to_p2pkh_script(unsolvable_address_key)
unsolvablep2wshp2pkh = CScript([OP_0, sha256(unsolvablep2pkh)])
p2shop0 = CScript([OP_HASH160, hash160(op0), OP_EQUAL])
p2wshop1 = CScript([OP_0, sha256(op1)])
@@ -454,7 +455,7 @@ class SegWitTest(BitcoinTestFramework):
else:
pubkey = hex_str_to_bytes(v['pubkey'])
p2pk = CScript([pubkey, OP_CHECKSIG])
- p2pkh = CScript([OP_DUP, OP_HASH160, hash160(pubkey), OP_EQUALVERIFY, OP_CHECKSIG])
+ p2pkh = key_to_p2pkh_script(pubkey)
importlist.append(p2pk.hex())
importlist.append(p2pkh.hex())
importlist.append(CScript([OP_0, hash160(pubkey)]).hex())