Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions pytonlib/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,12 +671,15 @@ async def try_locate_tx_by_incoming_message(self, source, destination, creation_

for shard_data in shards['shards']:
shardchain = shard_data['shard']
for b in range(3):

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 was not enough for some cases and transaction wouldn't be found. Increased to 10.

@dungeon-master-666 dungeon-master-666 Dec 20, 2023

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jdziworski-bc, thank you for your PR. I think there are these points to consider:

  1. Usually the distance of blocks with out_tx and in_tx becomes > 3 when the network experiences a high load and the message queue contains many entries. In that case, the distance might be even greater than 10.
  2. Under high load the network splits into shards.
  3. Under high load lite servers are usually busy and response time increases significantly.

Let's say the network has 10 shards, for each shard we lookup + read transactions of 10 blocks. In total, it results in 200 requests to the lite server in the worst case. It is not the desired outcome in toncenter.com/api/v2 because it puts an additional load on liteservers.
As an option, I suggest adding the parameter scan_blocks_count with default value 3 and you can adjust it for your use case. Would it work for you?

block = await self.lookup_block(workchain, shardchain, lt=int(creation_lt) + b * 1000000)
# Look for message in few subsequent blocks.
blocks_lt_distance = 1000000
creation_lt_rounded = int(int(creation_lt) / blocks_lt_distance * blocks_lt_distance)
for b in range(10):
block = await self.lookup_block(workchain, shardchain, lt=creation_lt_rounded + b * blocks_lt_distance)
Comment thread
dungeon-master-666 marked this conversation as resolved.
txs = await self.get_block_transactions(workchain,
shardchain,
block["seqno"],
count=40,
Comment thread
dungeon-master-666 marked this conversation as resolved.
count=500,
root_hash=block["root_hash"],
file_hash=block["file_hash"])
candidate = tuple()
Expand Down Expand Up @@ -714,7 +717,7 @@ async def try_locate_tx_by_outcoming_message(self, source, destination, creation
txses = await self.get_block_transactions(workchain,
shardchain,
block["seqno"],
count=40,
count=500,
root_hash=block["root_hash"],
file_hash=block["file_hash"])
candidate = tuple()
Expand Down