Skip to content

Commit a2c695d

Browse files
committed
Add test for P2TRCoinAddress.from_scriptPubKey
1 parent f5e9f71 commit a2c695d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

bitcointx/tests/test_wallet.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,15 @@ def recursive_check(aclass: type) -> None:
8484
xa = aclass.from_xonly_pubkey(XOnlyPubKey(pub))
8585
a = aclass.from_pubkey(pub)
8686
test.assertEqual(a, xa)
87+
xoa = aclass.from_xonly_output_pubkey(XOnlyPubKey(pub))
88+
a_from_spk = aclass.from_scriptPubKey(
89+
CScript(b'\x51\x20' + pub[1:]))
90+
test.assertEqual(a_from_spk, xoa)
8791
elif getattr(aclass, 'from_pubkey', None):
8892
a = aclass.from_pubkey(pub)
8993
elif getattr(aclass, 'from_redeemScript', None):
9094
a = aclass.from_redeemScript(
9195
CScript(b'\xa9' + Hash160(pub) + b'\x87'))
92-
elif issubclass(aclass, P2TRCoinAddress):
93-
a = aclass.from_scriptPubKey(
94-
CScript(b'\x51\x20' + pub[1:]))
9596
else:
9697
assert len(dispatcher_mapped_list(aclass)) > 0,\
9798
("dispatcher mapped list for {} "

0 commit comments

Comments
 (0)