From 3f36be661bc0cc07bc32076cbb2509c9f48f6857 Mon Sep 17 00:00:00 2001 From: Oleksandr Prudnikov Date: Fri, 24 Jan 2025 14:13:00 +0000 Subject: [PATCH] ruff format --- aiotx/clients/_ton_base_client.py | 8 ++++---- tests/test_ton/test_ton_monitoring.py | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/aiotx/clients/_ton_base_client.py b/aiotx/clients/_ton_base_client.py index 68f4203..949ee15 100644 --- a/aiotx/clients/_ton_base_client.py +++ b/aiotx/clients/_ton_base_client.py @@ -431,10 +431,10 @@ async def _process_shard(self, shard: dict, timeout_between_blocks: int): """Process all blocks in shard chain since last seen seqno""" shard_id = (shard["workchain"], shard["shard"]) current_seqno = shard["seqno"] - + # Get last processed seqno for this shard last_seqno = self.shard_last_seqno.get(shard_id, current_seqno - 1) - + # If we're up-to-date, process just the latest block if current_seqno <= last_seqno: return @@ -448,7 +448,7 @@ async def _process_shard(self, shard: dict, timeout_between_blocks: int): shard["workchain"], shard["shard"], seqno, - 1000 + 1000, ) ) @@ -458,7 +458,7 @@ async def _process_shard(self, shard: dict, timeout_between_blocks: int): if isinstance(transactions, Exception): logger.error(f"Failed to process shard block {shard_id}:{seqno}") continue - + await self.process_shard_transactions(transactions) # Update last processed seqno diff --git a/tests/test_ton/test_ton_monitoring.py b/tests/test_ton/test_ton_monitoring.py index e1b6733..771e2b2 100644 --- a/tests/test_ton/test_ton_monitoring.py +++ b/tests/test_ton/test_ton_monitoring.py @@ -5,7 +5,9 @@ from aiotx.clients import AioTxTONClient -@vcr_c.use_cassette("tests/fixtures/cassettes/ton/test_async_monitoring_with_shard_gaps_case.yaml") +@vcr_c.use_cassette( + "tests/fixtures/cassettes/ton/test_async_monitoring_with_shard_gaps_case.yaml" +) async def test_shard_block_skipping_monitoring_case(ton_client: AioTxTONClient): blocks = [] transactions = [] @@ -43,6 +45,7 @@ async def handle_transaction(transaction): tx["hash"] for tx in transactions ] + @vcr_c.use_cassette("tests/fixtures/cassettes/ton/test_async_monitoring_testnet.yaml") async def test_async_monitoring_testnet(ton_client: AioTxTONClient): blocks = []