From ce047e1f2addd375d04958a166948c5b47959fc8 Mon Sep 17 00:00:00 2001 From: ZigaMr Date: Mon, 23 May 2022 01:58:13 +0200 Subject: [PATCH] Used black --- listener.py | 11 +++++++---- mev_inspect/block.py | 8 ++++++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/listener.py b/listener.py index 9064e2f..70d9c84 100644 --- a/listener.py +++ b/listener.py @@ -61,17 +61,20 @@ async def run(): queue_name=HIGH_PRIORITY_QUEUE, priority=HIGH_PRIORITY, ) - + w3 = Web3(HTTPProvider(rpc)) - res = w3.provider.make_request('trace_block', ['earliest']) - if 'error' in res and res['error']['message'] == 'the method trace_block does not exist/is not available': + res = w3.provider.make_request("trace_block", ["earliest"]) + if ( + "error" in res + and res["error"]["message"] + == "the method trace_block does not exist/is not available" + ): type_e = RPCType.geth else: type_e = RPCType.parity base_provider = get_base_provider(rpc, type=type_e) # type_e = convert_str_to_enum(sys.argv[1]) inspector = MEVInspector(rpc, type_e) - while not killer.kill_now: await inspect_next_block( diff --git a/mev_inspect/block.py b/mev_inspect/block.py index a7578a2..cc5cb79 100644 --- a/mev_inspect/block.py +++ b/mev_inspect/block.py @@ -38,7 +38,11 @@ async def create_from_block_number( trace_db_session: Optional[orm.Session], ) -> Block: - type = RPCType.geth if geth_poa_middleware in w3.provider.middlewares else RPCType.parity + type = ( + RPCType.geth + if geth_poa_middleware in w3.provider.middlewares + else RPCType.parity + ) if type == RPCType.geth: block_json = await w3.eth.get_block(block_number) else: @@ -116,7 +120,7 @@ async def _find_or_fetch_block_traces( existing_block_traces = _find_block_traces(trace_db_session, block_number) if existing_block_traces is not None: return existing_block_traces - + if type == RPCType.geth: # Translate to parity format traces = await geth_get_tx_traces_parity_format(w3.provider, block_json)