Skip to content

Commit ab640a0

Browse files
authored
Fix is_type defect
Early scripts represent non-byte types in operations[0]
1 parent 1cfb674 commit ab640a0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

blockchain_parser/script.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,11 @@ def is_p2wpkh(self):
109109
return self.script.is_witness_v0_keyhash()
110110

111111
def is_p2tr(self):
112-
taproot = from_taproot(b2a_hex(self.operations[1]).decode("ascii"))
113-
return self.operations[0] == 1 \
114-
and isinstance(taproot, str) \
115-
and taproot.startswith("bc1p")
112+
if type(self.operations[1]) == bytes:
113+
taproot = from_taproot(b2a_hex(self.operations[1]).decode("ascii"))
114+
return self.operations[0] == 1 \
115+
and isinstance(taproot, str) \
116+
and taproot.startswith("bc1p")
116117

117118
def is_pubkey(self):
118119
return len(self.operations) == 2 \

0 commit comments

Comments
 (0)