py3port: a few more bytes literals
This commit is contained in:
parent
04329b6757
commit
46438767af
3 changed files with 7 additions and 7 deletions
|
|
@ -80,7 +80,7 @@ def test_daemon():
|
|||
p = start_cmd('cli','getblockcount',quiet=True)
|
||||
err = process_output(p,silent=True)[1]
|
||||
ret,state = p.wait(),None
|
||||
if "error: couldn't connect" in err or "error: Could not connect" in err:
|
||||
if b"error: couldn't connect" in err or b"error: Could not connect" in err:
|
||||
state = 'stopped'
|
||||
if not state: state = ('busy','ready')[ret==0]
|
||||
return state
|
||||
|
|
|
|||
10
mmgen/tx.py
10
mmgen/tx.py
|
|
@ -98,7 +98,7 @@ def segwit_is_active(exit_on_error=False):
|
|||
|
||||
def bytes2int(hex_bytes):
|
||||
r = hexlify(unhexlify(hex_bytes)[::-1])
|
||||
if r[0] in '89abcdef':
|
||||
if r[0] in b'89abcdef':
|
||||
die(3,"{}: Negative values not permitted in transaction!".format(hex_bytes))
|
||||
return int(r,16)
|
||||
|
||||
|
|
@ -106,11 +106,11 @@ def bytes2coin_amt(hex_bytes):
|
|||
return g.proto.coin_amt(bytes2int(hex_bytes) * g.proto.coin_amt.min_coin_unit)
|
||||
|
||||
def scriptPubKey2addr(s):
|
||||
if len(s) == 50 and s[:6] == '76a914' and s[-4:] == '88ac':
|
||||
if len(s) == 50 and s[:6] == b'76a914' and s[-4:] == b'88ac':
|
||||
return g.proto.pubhash2addr(s[6:-4],p2sh=False),'p2pkh'
|
||||
elif len(s) == 46 and s[:4] == 'a914' and s[-2:] == '87':
|
||||
elif len(s) == 46 and s[:4] == b'a914' and s[-2:] == b'87':
|
||||
return g.proto.pubhash2addr(s[4:-2],p2sh=True),'p2sh'
|
||||
elif len(s) == 44 and s[:4] == g.proto.witness_vernum_hex + '14':
|
||||
elif len(s) == 44 and s[:4] == g.proto.witness_vernum_hex + b'14':
|
||||
return g.proto.pubhash2bech32addr(s[4:]),'bech32'
|
||||
else:
|
||||
raise NotImplementedError('Unknown scriptPubKey ({})'.format(s))
|
||||
|
|
@ -135,7 +135,7 @@ class DeserializedTX(OrderedDict,MMGenObject): # need to add MMGen types
|
|||
bytes_len = 1 if s < 0xfd else 2 if s == 0xfd else 4 if s == 0xfe else 8
|
||||
if bytes_len != 1: del l[0]
|
||||
ret = int(hexlify(''.join(l[:bytes_len][::-1])),16)
|
||||
if sub_null: d['raw_tx'] += '\0'
|
||||
if sub_null: d['raw_tx'] += b'\0'
|
||||
elif not skip: d['raw_tx'] += ''.join(l[:bytes_len])
|
||||
del l[:bytes_len]
|
||||
return ret
|
||||
|
|
|
|||
|
|
@ -735,7 +735,7 @@ def keypress_confirm(prompt,default_yes=False,verbose=False,no_nl=False):
|
|||
return (False,True)[default_yes]
|
||||
|
||||
while True:
|
||||
reply = get_char(p).strip('\n\r')
|
||||
reply = get_char(p).strip(b'\n\r')
|
||||
if not reply:
|
||||
if default_yes: msg_r(nl); return True
|
||||
else: msg_r(nl); return False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue