Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 07c3373

Browse files
committed
add b prefix to byte strings
1 parent df373b0 commit 07c3373

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

ethereum/ethpow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ def check_pow(block_number, header_hash, mixhash, nonce, difficulty):
6969
# Grab current cache
7070
cache = get_cache(block_number)
7171
mining_output = hashimoto_light(block_number, cache, header_hash, nonce)
72-
if mining_output['mix digest'] != mixhash:
72+
if mining_output[b'mix digest'] != mixhash:
7373
return False
74-
return utils.big_endian_to_int(mining_output['result']) <= 2**256 / (difficulty or 1)
74+
return utils.big_endian_to_int(mining_output[b'result']) <= 2**256 / (difficulty or 1)
7575

7676

7777
class Miner():

ethereum/tests/test_abi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def test_abi_decode_single_hash():
5151

5252
def test_abi_decode_single_bytes():
5353
typ = ['bytes', '8', []]
54-
assert (b'\x01\x02' + b'\x00'*6) == abi.decode_single(typ, abi.encode_single(typ, '\x01\x02'))
54+
assert (b'\x01\x02' + b'\x00'*6) == abi.decode_single(typ, abi.encode_single(typ, b'\x01\x02'))
5555

5656
typ = ['bytes', '', []]
5757
assert b'\x01\x02' == abi.decode_single(typ, abi.encode_single(typ, b'\x01\x02'))

ethereum/transactions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def sender(self):
9696
except Exception:
9797
raise InvalidTransaction("Invalid signature values (x^3+7 is non-residue)")
9898

99-
if pub[1:] == "\x00" * 32:
99+
if pub[1:] == b"\x00" * 32:
100100
raise InvalidTransaction("Invalid signature (zero privkey cannot sign)")
101101
pub = encode_pubkey(pub, 'bin')
102102
self._sender = utils.sha3(pub[1:])[-20:]

ethereum/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def check_and_strip_checksum(x):
137137

138138

139139
def normalize_address(x, allow_blank=False):
140-
if allow_blank and x == '':
140+
if allow_blank and (x == '' or x == b''):
141141
return ''
142142
if len(x) in (42, 50) and x[:2] == '0x':
143143
x = x[2:]

0 commit comments

Comments
 (0)