diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2022-06-07 01:42:58 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2022-06-14 13:32:57 +0200 |
commit | 1999dcfa40ddedb6cf15f9d66b90fa0f537b4842 (patch) | |
tree | 7eec622fa02a7da9a065b12c9f0130d7279de68c /test/functional/wallet_taproot.py | |
parent | 9e4fbebcc8e497016563e46de4c64fa094edab2d (diff) |
test: add helpers for creating P2TR scripts/addresses from output key
Diffstat (limited to 'test/functional/wallet_taproot.py')
-rwxr-xr-x | test/functional/wallet_taproot.py | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/test/functional/wallet_taproot.py b/test/functional/wallet_taproot.py index a4d836c8fe..d238c50bca 100755 --- a/test/functional/wallet_taproot.py +++ b/test/functional/wallet_taproot.py @@ -7,19 +7,18 @@ import random from decimal import Decimal +from test_framework.address import output_key_to_p2tr from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal from test_framework.descriptors import descsum_create from test_framework.script import ( CScript, MAX_PUBKEYS_PER_MULTI_A, - OP_1, OP_CHECKSIG, OP_CHECKSIGADD, OP_NUMEQUAL, taproot_construct, ) -from test_framework.segwit_addr import encode_segwit_address # xprvs/xpubs, and m/* derived x-only pubkeys (created using independent implementation) KEYS = [ @@ -183,10 +182,7 @@ def multi_a(k, hex_keys, sort=False): def compute_taproot_address(pubkey, scripts): """Compute the address for a taproot output with given inner key and scripts.""" - tap = taproot_construct(pubkey, scripts) - assert tap.scriptPubKey[0] == OP_1 - assert tap.scriptPubKey[1] == 0x20 - return encode_segwit_address("bcrt", 1, tap.scriptPubKey[2:]) + return output_key_to_p2tr(taproot_construct(pubkey, scripts).output_pubkey) class WalletTaprootTest(BitcoinTestFramework): """Test generation and spending of P2TR address outputs.""" |