I've also changed the ScriptPubKey's parse method so it accepts both stream and raw kwargs as inherited Script class handles, otherwise we get an error and in case parse_hex() method is used:
Before:
>>> from io import BytesIO
>>> from buidl.taproot import TapScript
>>> TapScript.parse_hex('52935487')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "~/Documents/projects/bitcoin/buidl-python/buidl/script.py", line 116, in parse_hex
return cls.parse(raw=bytes.fromhex(hex_str))
TypeError: ScriptPubKey.parse() got an unexpected keyword argument 'raw'
After:
>>> from io import BytesIO
>>> from buidl.taproot import TapScript
>>> TapScript.parse_hex('52935487')
OP_2 OP_ADD OP_4 OP_EQUAL
Let me know if it's ok. I will also be adding some test for above test cases.
PR opened as per https://github.com/buidl-bitcoin/buidl-python/issues/159 and fixes the described issue.
I've also changed the
ScriptPubKey
'sparse
method so it accepts bothstream
andraw
kwargs as inheritedScript
class handles, otherwise we get an error and in caseparse_hex()
method is used:Before:
After:
Let me know if it's ok. I will also be adding some test for above test cases.