toncenter / pytonlib

Python SDK for TON via tonlib
GNU General Public License v3.0
81 stars 21 forks source link

I have a odd error #54

Open Dark-horse-007 opened 9 months ago

Dark-horse-007 commented 9 months ago

Code:

from ton.sync import TonlibClient
client = TonlibClient()
TonlibClient.enable_unaudited_binaries()
client.init_tonlib()
seed = "24 security phrases"
wallet = client.import_wallet(seed)
balance = client.from_nano(wallet.get_balance())
print(balance)

error:

Traceback (most recent call last):
  File "test", line 13, in <module>
    print(wallet.get_balance())
  File "/usr/local/lib/python3.8/dist-packages/ton/sync.py", line 19, in syncified
    return loop.run_until_complete(coro)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.8/dist-packages/ton/account/state_methods.py", line 24, in get_balance
    (await self.get_state(force=True, **kwargs)).balance  # nanoTONs
  File "/usr/local/lib/python3.8/dist-packages/ton/account/state_methods.py", line 14, in get_state
    await self.load_state(**kwargs)
  File "/usr/local/lib/python3.8/dist-packages/ton/account/state_methods.py", line 8, in load_state
    self.state = await self.client.tonlib_wrapper.execute(
  File "/usr/local/lib/python3.8/dist-packages/ton/tonlibjson.py", line 175, in execute
    result = await self._execute(query, timeout=timeout)
ton.tonlibjson.TonlibError: LITE_SERVER_UNKNOWN: timeout(during last block synchronization)

I'm running this on a DigitalOcean server so my internet isn't a problem

xurvan commented 6 months ago

I ran into a similar issue myself, and it turned out to be related to "ls_index." Maybe this could help you too!

client = TonlibClient(ls_index=2)

I think you can check this post too: https://stackoverflow.com/questions/77961843/