Skip to content

Commit 3162c91

Browse files
committed
test: fix MiniWallet internal key derivation for tagged instances
Not every pseudorandom hash result is a valid x-only public key, so the pubkey tweaking in the course of creating the output public key would fail about every second time. Fix this by treating the hash result as private key and calculate the x-only public key out of that, to be used then as internal key.
1 parent c9f7364 commit 3162c91

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

test/functional/test_framework/wallet.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def __init__(self, test_node, *, mode=MiniWalletMode.ADDRESS_OP_TRUE, tag_name=N
105105
pub_key = self._priv_key.get_pubkey()
106106
self._scriptPubKey = key_to_p2pk_script(pub_key.get_bytes())
107107
elif mode == MiniWalletMode.ADDRESS_OP_TRUE:
108-
internal_key = None if tag_name is None else hash256(tag_name.encode())
108+
internal_key = None if tag_name is None else compute_xonly_pubkey(hash256(tag_name.encode()))[0]
109109
self._address, self._taproot_info = create_deterministic_address_bcrt1_p2tr_op_true(internal_key)
110110
self._scriptPubKey = address_to_scriptpubkey(self._address)
111111

0 commit comments

Comments
 (0)