diff --git a/newsfragments/1445.bugfix.rst b/newsfragments/1445.bugfix.rst new file mode 100644 index 0000000000..36e712201c --- /dev/null +++ b/newsfragments/1445.bugfix.rst @@ -0,0 +1 @@ +Add null check to logsbloom formatter diff --git a/web3/middleware/pythonic.py b/web3/middleware/pythonic.py index ca8ae15171..38d9a40ea4 100644 --- a/web3/middleware/pythonic.py +++ b/web3/middleware/pythonic.py @@ -166,7 +166,7 @@ def to_hexbytes(num_bytes, val, variable_length=False): 'size': to_integer_if_hex, 'timestamp': to_integer_if_hex, 'hash': apply_formatter_if(is_not_null, to_hexbytes(32)), - 'logsBloom': to_hexbytes(256), + 'logsBloom': apply_formatter_if(is_not_null, to_hexbytes(256)), 'miner': apply_formatter_if(is_not_null, to_checksum_address), 'mixHash': to_hexbytes(32), 'nonce': apply_formatter_if(is_not_null, to_hexbytes(8, variable_length=True)),