Return an iterator of lists instead
This commit is contained in:
parent
f4bba7c885
commit
e7c1799fd7
@ -15,10 +15,11 @@ def get_miner_payments(
|
||||
miner_payments = []
|
||||
|
||||
for transaction_hash, transaciton_traces in get_traces_by_transaction_hash(traces):
|
||||
eth_transfers = get_eth_transfers(list(transaciton_traces))
|
||||
eth_transfers = get_eth_transfers(transaciton_traces)
|
||||
miner_eth_transfers = filter_transfers(
|
||||
eth_transfers, to_address=miner_address.lower()
|
||||
)
|
||||
|
||||
total_eth_transfer_payment = sum(
|
||||
transfer.amount for transfer in miner_eth_transfers
|
||||
)
|
||||
|
@ -1,5 +1,5 @@
|
||||
from itertools import groupby
|
||||
from typing import List
|
||||
from typing import Iterator, List, Tuple
|
||||
|
||||
from mev_inspect.schemas.classified_traces import ClassifiedTrace
|
||||
|
||||
@ -36,6 +36,10 @@ def get_child_traces(
|
||||
|
||||
def get_traces_by_transaction_hash(
|
||||
traces: List[ClassifiedTrace],
|
||||
) -> groupby[str, ClassifiedTrace]:
|
||||
) -> Iterator[Tuple[str, List[ClassifiedTrace]]]:
|
||||
get_transaction_hash = lambda trace: trace.transaction_hash
|
||||
return groupby(sorted(traces, key=get_transaction_hash), key=get_transaction_hash)
|
||||
for transaction_hash, transaction_traces in groupby(
|
||||
sorted(traces, key=get_transaction_hash),
|
||||
key=get_transaction_hash,
|
||||
):
|
||||
yield transaction_hash, list(transaction_traces)
|
||||
|
Loading…
x
Reference in New Issue
Block a user