From 6f9889a52e3911390bcccbec1fdd092e653f7f5e Mon Sep 17 00:00:00 2001 From: Nick Williams Date: Thu, 5 Sep 2019 12:50:35 +1000 Subject: [PATCH] fixing bug where an attempt to format logsBloom to hexbytes fails when logsBloom is null --- newsfragments/1445.bugfix.rst | 1 + web3/middleware/pythonic.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 newsfragments/1445.bugfix.rst 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)),