From afd8a4494287660bdc6697ca1794b787af083827 Mon Sep 17 00:00:00 2001 From: Jakub Dziworski <94838237+jdziworski-bc@users.noreply.github.com> Date: Thu, 7 Dec 2023 17:01:14 +0100 Subject: [PATCH 1/4] Increase `try_locate_tx_by_incoming_message` block search range --- pytonlib/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytonlib/client.py b/pytonlib/client.py index ef0fec8..94bc888 100644 --- a/pytonlib/client.py +++ b/pytonlib/client.py @@ -671,7 +671,7 @@ 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): + for b in range(10): block = await self.lookup_block(workchain, shardchain, lt=int(creation_lt) + b * 1000000) txs = await self.get_block_transactions(workchain, shardchain, From 24e1fa1dd2cf993af8d55194c651f186f10bf7b2 Mon Sep 17 00:00:00 2001 From: Jakub Dziworski <94838237+jdziworski-bc@users.noreply.github.com> Date: Thu, 14 Dec 2023 12:27:04 +0100 Subject: [PATCH 2/4] Increase max block transactions limit --- pytonlib/client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pytonlib/client.py b/pytonlib/client.py index 94bc888..49ef7e9 100644 --- a/pytonlib/client.py +++ b/pytonlib/client.py @@ -676,7 +676,7 @@ async def try_locate_tx_by_incoming_message(self, source, destination, creation_ txs = 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() @@ -690,7 +690,7 @@ async def try_locate_tx_by_incoming_message(self, source, destination, creation_ txses = await self.get_transactions(destination, from_transaction_lt=candidate[1], from_transaction_hash=b64str_to_hex(candidate[0]), - limit=max(count, 10)) + limit=max(count, 40)) for tx in txses: try: in_msg = tx["in_msg"] @@ -714,7 +714,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() From d3406de148ba6b11f51acda4d4c8dd1d1ba55f44 Mon Sep 17 00:00:00 2001 From: Jakub Dziworski <94838237+jdziworski-bc@users.noreply.github.com> Date: Thu, 14 Dec 2023 17:24:15 +0100 Subject: [PATCH 3/4] Update client.py --- pytonlib/client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pytonlib/client.py b/pytonlib/client.py index 49ef7e9..35ef632 100644 --- a/pytonlib/client.py +++ b/pytonlib/client.py @@ -4,6 +4,7 @@ import struct import logging import os +from math import floor from pytonlib.tonlibjson import TonLib from pytonlib.utils.address import prepare_address, detect_address @@ -671,8 +672,11 @@ async def try_locate_tx_by_incoming_message(self, source, destination, creation_ for shard_data in shards['shards']: shardchain = shard_data['shard'] + # 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=int(creation_lt) + b * 1000000) + block = await self.lookup_block(workchain, shardchain, lt=creation_lt_rounded + b * blocks_lt_distance) txs = await self.get_block_transactions(workchain, shardchain, block["seqno"], @@ -690,7 +694,7 @@ async def try_locate_tx_by_incoming_message(self, source, destination, creation_ txses = await self.get_transactions(destination, from_transaction_lt=candidate[1], from_transaction_hash=b64str_to_hex(candidate[0]), - limit=max(count, 40)) + limit=max(count, 10)) for tx in txses: try: in_msg = tx["in_msg"] From e4d18a9b1af2f4c6f13296cedf606802c741393e Mon Sep 17 00:00:00 2001 From: Jakub Dziworski <94838237+jdziworski-bc@users.noreply.github.com> Date: Thu, 14 Dec 2023 17:28:16 +0100 Subject: [PATCH 4/4] Update client.py --- pytonlib/client.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pytonlib/client.py b/pytonlib/client.py index 35ef632..8c5ed31 100644 --- a/pytonlib/client.py +++ b/pytonlib/client.py @@ -4,7 +4,6 @@ import struct import logging import os -from math import floor from pytonlib.tonlibjson import TonLib from pytonlib.utils.address import prepare_address, detect_address