Skip to content

Commit a87816c

Browse files
authored
Don't format if 'withdrawals' coming back from get_block is null (#2941)
* Don't format if 'withdrawals' coming back from get_block is null * Add newsfragment
1 parent 29262c9 commit a87816c

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

newsfragments/2941.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add check for null withdrawal field on get_block response

web3/_utils/method_formatters.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,9 @@ def apply_list_to_array_formatter(formatter: Any) -> Callable[..., Any]:
297297
)
298298
),
299299
"transactionsRoot": apply_formatter_if(is_not_null, to_hexbytes(32)),
300-
"withdrawals": apply_formatter_to_array(withdrawal_result_formatter),
300+
"withdrawals": apply_formatter_if(
301+
is_not_null, apply_list_to_array_formatter(withdrawal_result_formatter)
302+
),
301303
"withdrawalsRoot": apply_formatter_if(is_not_null, to_hexbytes(32)),
302304
}
303305

0 commit comments

Comments
 (0)