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,
|
queue_name=HIGH_PRIORITY_QUEUE,
|
||||||
priority=HIGH_PRIORITY,
|
priority=HIGH_PRIORITY,
|
||||||
)
|
)
|
||||||
|
|
||||||
w3 = Web3(HTTPProvider(rpc))
|
w3 = Web3(HTTPProvider(rpc))
|
||||||
res = w3.provider.make_request('trace_block', ['earliest'])
|
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':
|
if (
|
||||||
|
"error" in res
|
||||||
|
and res["error"]["message"]
|
||||||
|
== "the method trace_block does not exist/is not available"
|
||||||
|
):
|
||||||
type_e = RPCType.geth
|
type_e = RPCType.geth
|
||||||
else:
|
else:
|
||||||
type_e = RPCType.parity
|
type_e = RPCType.parity
|
||||||
base_provider = get_base_provider(rpc, type=type_e)
|
base_provider = get_base_provider(rpc, type=type_e)
|
||||||
# type_e = convert_str_to_enum(sys.argv[1])
|
# type_e = convert_str_to_enum(sys.argv[1])
|
||||||
inspector = MEVInspector(rpc, type_e)
|
inspector = MEVInspector(rpc, type_e)
|
||||||
|
|
||||||
|
|
||||||
while not killer.kill_now:
|
while not killer.kill_now:
|
||||||
await inspect_next_block(
|
await inspect_next_block(
|
||||||
|
@ -38,7 +38,11 @@ async def create_from_block_number(
|
|||||||
trace_db_session: Optional[orm.Session],
|
trace_db_session: Optional[orm.Session],
|
||||||
) -> Block:
|
) -> 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:
|
if type == RPCType.geth:
|
||||||
block_json = await w3.eth.get_block(block_number)
|
block_json = await w3.eth.get_block(block_number)
|
||||||
else:
|
else:
|
||||||
@ -116,7 +120,7 @@ async def _find_or_fetch_block_traces(
|
|||||||
existing_block_traces = _find_block_traces(trace_db_session, block_number)
|
existing_block_traces = _find_block_traces(trace_db_session, block_number)
|
||||||
if existing_block_traces is not None:
|
if existing_block_traces is not None:
|
||||||
return existing_block_traces
|
return existing_block_traces
|
||||||
|
|
||||||
if type == RPCType.geth:
|
if type == RPCType.geth:
|
||||||
# Translate to parity format
|
# Translate to parity format
|
||||||
traces = await geth_get_tx_traces_parity_format(w3.provider, block_json)
|
traces = await geth_get_tx_traces_parity_format(w3.provider, block_json)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user