Used black
This commit is contained in:
parent
f1431cec4c
commit
ce047e1f2a
11
listener.py
11
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(
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user