transaction: psbt.from_raw_psbt: clarify hex input must be str
no functional change (besides incorrect input now raising a different exception) ``` >>> bytes.fromhex(b"deadbeef") TypeError: fromhex() argument must be str, not bytes ```
This commit is contained in:
@@ -2202,9 +2202,9 @@ class PartialTransaction(Transaction):
|
|||||||
return res
|
return res
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_raw_psbt(cls, raw) -> 'PartialTransaction':
|
def from_raw_psbt(cls, raw: Union[str, bytes, bytearray]) -> 'PartialTransaction':
|
||||||
# auto-detect and decode Base64 and Hex.
|
# auto-detect and decode Base64 and Hex.
|
||||||
if raw[0:10].lower() in (b'70736274ff', '70736274ff'): # hex
|
if raw[0:10].lower() == '70736274ff': # hex (str)
|
||||||
raw = bytes.fromhex(raw)
|
raw = bytes.fromhex(raw)
|
||||||
elif raw[0:6] in (b'cHNidP', 'cHNidP'): # base64
|
elif raw[0:6] in (b'cHNidP', 'cHNidP'): # base64
|
||||||
raw = base64.b64decode(raw, validate=True)
|
raw = base64.b64decode(raw, validate=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user