Chainging w3.eth.fee_history parameter so that the default is not None

It appears that fee_history must receive an array as the third parameter
and it's default None value does not work with some json-rpc nodes.
This commit is contained in:
idobn 2022-02-04 20:13:00 +02:00
parent bf58418847
commit 9d89582f22

View File

@ -2,7 +2,7 @@ from web3 import Web3
async def fetch_base_fee_per_gas(w3: Web3, block_number: int) -> int:
base_fees = await w3.eth.fee_history(1, block_number)
base_fees = await w3.eth.fee_history(1, block_number, [])
base_fees_per_gas = base_fees["baseFeePerGas"]
if len(base_fees_per_gas) == 0:
raise RuntimeError("Unexpected error - no fees returned")