Return to default printing. Add option to print miner payments
This commit is contained in:
parent
a960d5e4cf
commit
0e6cd420ec
@ -73,10 +73,11 @@ def _inspect_block(
|
|||||||
base_provider,
|
base_provider,
|
||||||
block_number: int,
|
block_number: int,
|
||||||
should_cache: bool,
|
should_cache: bool,
|
||||||
should_print_stats: bool = False,
|
should_print_stats: bool = True,
|
||||||
should_write_classified_traces: bool = True,
|
should_write_classified_traces: bool = True,
|
||||||
should_write_swaps: bool = True,
|
should_write_swaps: bool = True,
|
||||||
should_write_arbitrages: bool = True,
|
should_write_arbitrages: bool = True,
|
||||||
|
should_print_miner_payments: bool = False,
|
||||||
):
|
):
|
||||||
|
|
||||||
block_data = block.create_from_block_number(
|
block_data = block.create_from_block_number(
|
||||||
@ -104,12 +105,6 @@ def _inspect_block(
|
|||||||
delete_classified_traces_for_block(db_session, block_number)
|
delete_classified_traces_for_block(db_session, block_number)
|
||||||
write_classified_traces(db_session, classified_traces)
|
write_classified_traces(db_session, classified_traces)
|
||||||
|
|
||||||
miner_payments = get_miner_payments(
|
|
||||||
block_data.miner, classified_traces, block_data.receipts
|
|
||||||
)
|
|
||||||
click.echo("Miner payments:")
|
|
||||||
click.echo(json.dumps([p.dict() for p in miner_payments], indent=4))
|
|
||||||
|
|
||||||
swaps = get_swaps(classified_traces)
|
swaps = get_swaps(classified_traces)
|
||||||
click.echo(f"Found {len(swaps)} swaps")
|
click.echo(f"Found {len(swaps)} swaps")
|
||||||
|
|
||||||
@ -128,6 +123,13 @@ def _inspect_block(
|
|||||||
stats = get_stats(classified_traces)
|
stats = get_stats(classified_traces)
|
||||||
click.echo(json.dumps(stats, indent=4))
|
click.echo(json.dumps(stats, indent=4))
|
||||||
|
|
||||||
|
miner_payments = get_miner_payments(
|
||||||
|
block_data.miner, classified_traces, block_data.receipts
|
||||||
|
)
|
||||||
|
|
||||||
|
if should_print_miner_payments:
|
||||||
|
click.echo(json.dumps([p.dict() for p in miner_payments], indent=4))
|
||||||
|
|
||||||
|
|
||||||
def get_stats(classified_traces) -> dict:
|
def get_stats(classified_traces) -> dict:
|
||||||
stats: dict = {}
|
stats: dict = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user