Skip to content

Commit

Permalink
ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr Prudnikov committed Jan 24, 2025
1 parent 7c57860 commit 3f36be6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 4 additions & 4 deletions aiotx/clients/_ton_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -448,7 +448,7 @@ async def _process_shard(self, shard: dict, timeout_between_blocks: int):
shard["workchain"],
shard["shard"],
seqno,
1000
1000,
)
)

Expand All @@ -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
Expand Down
5 changes: 4 additions & 1 deletion tests/test_ton/test_ton_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -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 = []
Expand Down

0 comments on commit 3f36be6

Please sign in to comment.