Skip to content

AttributeError: 'NoneType' object has no attribute 'seqno' with trust_level 0 #33

Description

@QuisEgoSum

pytoniq 0.1.39
python 3.11

import asyncio

from pytoniq import LiteClient


async def main():
    client = LiteClient.from_mainnet_config(  # choose mainnet, testnet or custom config dict
        ls_i=0,  # index of liteserver from config
        trust_level=0,  # trust level to liteserver
        timeout=15  # timeout not includes key blocks synchronization as it works in pytonlib
    )

    await client.connect()


if __name__ == '__main__':
    asyncio.run(main())

With some probability I get:

Traceback (most recent call last):
  File "<rootPath>/pytoniq_test.py", line 44, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "<rootPath>/pytoniq_test.py", line 13, in main
    await client.connect()
  File "<rootPath>/.venv/lib/python3.11/site-packages/pytoniq/liteclient/client.py", line 190, in connect
    await self.update_last_blocks()
  File "<rootPath>/.venv/lib/python3.11/site-packages/pytoniq/liteclient/client.py", line 310, in update_last_blocks
    self.last_mc_block = await self.get_trusted_last_mc_block()
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<rootPath>/.venv/lib/python3.11/site-packages/pytoniq/liteclient/client.py", line 306, in get_trusted_last_mc_block
    await self.get_mc_block_proof(known_block=self.last_key_block, target_block=last_block)
  File "<rootPath>/.venv/lib/python3.11/site-packages/pytoniq/liteclient/client.py", line 982, in get_mc_block_proof
    while last_proved != target_block:
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<rootPath>/.venv/lib/python3.11/site-packages/pytoniq_core/tl/block.py", line 66, in __eq__
    if self.seqno != other.seqno or self.workchain != other.workchain or self.shard != other.shard or self.root_hash != other.root_hash or self.file_hash != other.file_hash:
                     ^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'seqno'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions