minor cleanups (2 files)
This commit is contained in:
parent
c88f2a9388
commit
acffdda309
2 changed files with 6 additions and 6 deletions
|
|
@ -18,9 +18,9 @@ class OpReturnData(bytes, InitErrors):
|
|||
|
||||
def __new__(cls, proto, data_spec):
|
||||
|
||||
desc = 'OpReturnData initializer'
|
||||
desc = 'OP_RETURN data'
|
||||
|
||||
assert isinstance(data_spec, str), f'{desc} must be a string'
|
||||
assert isinstance(data_spec, str), f'{desc} argument must be a string'
|
||||
|
||||
if data_spec.startswith('hexdata:'):
|
||||
hexdata = data_spec[8:]
|
||||
|
|
@ -32,12 +32,12 @@ class OpReturnData(bytes, InitErrors):
|
|||
try:
|
||||
ret = data_spec[5:].encode('utf8')
|
||||
except:
|
||||
raise ValueError(f'{desc} string be UTF-8 encoded')
|
||||
raise ValueError(f'{desc} value must be UTF-8 encoded')
|
||||
else:
|
||||
raise ValueError(f'{desc} string must start with ‘data:’ or ‘hexdata:’')
|
||||
raise ValueError(f'{desc} argument must start with ‘data:’ or ‘hexdata:’')
|
||||
|
||||
assert 1 <= len(ret) <= proto.max_op_return_data_len, (
|
||||
f'{len(ret)}: {desc} string encoded byte length not in range 1-{proto.max_op_return_data_len}')
|
||||
f'{len(ret)}: invalid {desc} length: not in range 1-{proto.max_op_return_data_len}')
|
||||
|
||||
return bytes.__new__(cls, ret)
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ async def test_tx(tx_proto, tx_hex, desc, n):
|
|||
dt = DeserializeTX(tx_proto, tx_hex)
|
||||
|
||||
if cfg.verbose:
|
||||
Msg('\n\n================================ Core vector: ==================================')
|
||||
Msg('\n\n=============================== Bitcoin Core: ==================================')
|
||||
Msg_r('.' if cfg.quiet else f'{n:>3}) {desc}\n')
|
||||
if cfg.verbose:
|
||||
Pmsg(d)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue