From 09556258a739b3116602391f99ec6c14aa27d742 Mon Sep 17 00:00:00 2001 From: Andrey Tvorozhkov Date: Sat, 16 Aug 2025 13:52:44 +0300 Subject: [PATCH 01/11] Fix images --- .github/workflows/wheels.yml | 68 ++++-------------------------------- 1 file changed, 6 insertions(+), 62 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 5e5a88c..4c7e91d 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -18,35 +18,36 @@ permissions: jobs: build: strategy: + fail-fast: false matrix: include: # macOS x86_64 - arch: x86_64 - os: macos-latest + os: macos-13 python: "3.8" link: https://github.com/disintar/ton/releases/download/ton-cpython-38-x86_64-darwin/ file: python_ton.cpython-38-darwin.so fix_tag: x86_64 - arch: x86_64 - os: macos-latest + os: macos-13 python: "3.10" link: https://github.com/disintar/ton/releases/download/ton-cpython-310-x86_64-darwin/ file: python_ton.cpython-310-darwin.so fix_tag: x86_64 - arch: x86_64 - os: macos-latest + os: macos-13 python: "3.11" link: https://github.com/disintar/ton/releases/download/ton-cpython-311-x86_64-darwin/ file: python_ton.cpython-311-darwin.so fix_tag: x86_64 - arch: x86_64 - os: macos-latest + os: macos-13 python: "3.12" link: https://github.com/disintar/ton/releases/download/ton-cpython-312-x86_64-darwin/ file: python_ton.cpython-312-darwin.so fix_tag: x86_64 - arch: x86_64 - os: macos-latest + os: macos-13 python: "3.13" link: https://github.com/disintar/ton/releases/download/ton-cpython-313-x86_64-darwin/ file: python_ton.cpython-313-darwin.so @@ -204,63 +205,6 @@ jobs: name: python-package-distributions path: dist - buildMacOs39: - strategy: - matrix: - include: - - arch: x86_64 - os: macos-latest - python: "3.9" - link: https://github.com/disintar/ton/releases/download/ton-cpython-39-x86_64-darwin/ - file: python_ton.cpython-39-darwin.so - fix_tag: x86_64 - - - arch: aarch64 - os: macos-15 - python: "3.9" - link: https://github.com/disintar/ton/releases/download/ton-cpython-39-aarch64-darwin/ - file: python_ton.cpython-39-darwin.so - fix_tag: arm64 - - runs-on: ${{ matrix.os }} - - steps: - - uses: actions/checkout@v4 - - name: Install python3.9 - run: | - /opt/homebrew/bin/brew install python@3.9 - if: matrix.os == 'macOS' - - - name: Install python3.9 - run: | - brew install python@3.9 - if: matrix.os == 'macos-latest' - - - name: Install deps - run: | - python3.9 -m pip install -r built_requirements.txt - python3.9 -m pip install -r requirements.txt - - - name: Download prebuilt - run: | - curl -Lo ./src/tonpy/libs/${{ matrix.file }} ${{ matrix.link }}${{ matrix.file }} - - - name: Run tests - run: | - python3.9 -m pytest - - - name: Build wheel - run: | - python3.9 -m build --wheel --outdir dist/ . - python3.9 fix_whl_name.py - env: - TAG_FIX: ${{ matrix.fix_tag }} - - name: Store the binary wheel - uses: actions/upload-artifact@v4 - with: - name: python-package-distributions - path: dist - # buildVirtualLinux: # strategy: # matrix: From c744254a686716b60744e60a38a826b29ce08693 Mon Sep 17 00:00:00 2001 From: Andrey Tvorozhkov Date: Sat, 16 Aug 2025 13:53:29 +0300 Subject: [PATCH 02/11] Macos buildMacOs39 remove --- .github/workflows/wheels.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 4c7e91d..2ac5a2f 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -265,7 +265,6 @@ jobs: needs: # - buildVirtualLinux - build - - buildMacOs39 steps: - uses: actions/checkout@v4 From 59de3edc537fc40fb4dfa597594d99ca908ed275 Mon Sep 17 00:00:00 2001 From: Andrey Tvorozhkov Date: Sat, 16 Aug 2025 14:00:26 +0300 Subject: [PATCH 03/11] Build upload-artifacts fix --- .github/workflows/docs.yml | 2 +- .github/workflows/wheels.yml | 29 +++++++++++++++++++---------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 201730a..b3f2ddf 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -39,7 +39,7 @@ jobs: run: | cd docs && make html - name: Upload artifact - uses: actions/upload-pages-artifact@v1 + uses: actions/upload-pages-artifact@v3 with: path: './docs/build/html' - name: Deploy to GitHub Pages diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 2ac5a2f..79efb4d 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -67,27 +67,27 @@ jobs: file: python_ton.cpython-313-x86_64-linux-gnu.so fix_tag: manylinux2014_x86_64 - # Legacy Linux x86_64 (kuber) kept + # Legacy Linux x86_64 (arc-runner-set) kept - arch: x86_64 - os: kuber + os: arc-runner-set python: "3.8" link: https://github.com/disintar/ton/releases/download/ton-cpython-38-x86_64-linux/ file: python_ton.cpython-38-x86_64-linux-gnu.so fix_tag: manylinux2014_x86_64 - arch: x86_64 - os: kuber + os: arc-runner-set python: "3.9" link: https://github.com/disintar/ton/releases/download/ton-cpython-39-x86_64-linux/ file: python_ton.cpython-39-x86_64-linux-gnu.so fix_tag: manylinux2014_x86_64 - arch: x86_64 - os: kuber + os: arc-runner-set python: "3.10" link: https://github.com/disintar/ton/releases/download/ton-cpython-310-x86_64-linux/ file: python_ton.cpython-310-x86_64-linux-gnu.so fix_tag: manylinux2014_x86_64 - arch: x86_64 - os: kuber + os: arc-runner-set python: "3.11" link: https://github.com/disintar/ton/releases/download/ton-cpython-311-x86_64-linux/ file: python_ton.cpython-311-x86_64-linux-gnu.so @@ -176,7 +176,7 @@ jobs: run: | sudo apt update sudo apt install -y curl - if: matrix.os == 'kuber' + if: matrix.os == 'arc-runner-set' - name: Download prebuilt run: | @@ -199,10 +199,11 @@ jobs: python fix_whl_name.py env: TAG_FIX: ${{ matrix.fix_tag }} + - name: Store the binary wheel uses: actions/upload-artifact@v4 with: - name: python-package-distributions + name: python-package-distributions-${{ github.run_id }}-${{ matrix.arch }}-${{ matrix.python }} path: dist # buildVirtualLinux: @@ -261,7 +262,7 @@ jobs: deploy: name: Publish 🐍📦 to PyPI - runs-on: kuber + runs-on: arc-runner-set needs: # - buildVirtualLinux - build @@ -273,10 +274,18 @@ jobs: python-version: "3.11" env: USER: tvorogme + - name: Merge artifacts + uses: actions/upload-artifact/merge@v4 + if: always() + with: + name: python-package-distributions-${{ github.run_id }} + pattern: python-package-distributions-${{ github.run_id }}-* + delete-merged: true + - name: Download all the dists - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: - name: python-package-distributions + name: python-package-distributions-${{ github.run_id }} path: dist/ - name: Install deps From f103e3cb7e3cc0282712528fe719d5b0fde6f254 Mon Sep 17 00:00:00 2001 From: Andrey Tvorozhkov Date: Sat, 16 Aug 2025 14:02:01 +0300 Subject: [PATCH 04/11] Replace windows-2019 with windows-2022 --- .github/workflows/wheels.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 79efb4d..a4d0e92 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -127,31 +127,31 @@ jobs: # Windows x64 - arch: x86_64 - os: windows-2019 + os: windows-2022 python: "3.9" link: https://github.com/disintar/ton/releases/download/ton-cpython-39-x86_64-windows/ file: python_ton.cp39-win_amd64.pyd fix_tag: - arch: x86_64 - os: windows-2019 + os: windows-2022 python: "3.10" link: https://github.com/disintar/ton/releases/download/ton-cpython-310-x86_64-windows/ file: python_ton.cp310-win_amd64.pyd fix_tag: - arch: x86_64 - os: windows-2019 + os: windows-2022 python: "3.11" link: https://github.com/disintar/ton/releases/download/ton-cpython-311-x86_64-windows/ file: python_ton.cp311-win_amd64.pyd fix_tag: - arch: x86_64 - os: windows-2019 + os: windows-2022 python: "3.12" link: https://github.com/disintar/ton/releases/download/ton-cpython-312-x86_64-windows/ file: python_ton.cp312-win_amd64.pyd fix_tag: - arch: x86_64 - os: windows-2019 + os: windows-2022 python: "3.13" link: https://github.com/disintar/ton/releases/download/ton-cpython-313-x86_64-windows/ file: python_ton.cp313-win_amd64.pyd @@ -187,7 +187,7 @@ jobs: mv win/libcrypto-1_1-x64.dll ./src/tonpy/libs/ mv MANIFEST.in MANIFEST_LINUX.in mv MANIFEST_WIN.in MANIFEST.in - if: matrix.os == 'windows-2019' + if: matrix.os == 'windows-2022' - name: Run tests run: | From d389a402c87f4fdefab0c9b23e44f68b1a28421d Mon Sep 17 00:00:00 2001 From: Andrey Tvorozhkov Date: Sat, 16 Aug 2025 14:08:13 +0300 Subject: [PATCH 05/11] Remove 3.8 support, optimize builds --- .github/workflows/wheels.yml | 21 +++++++-------------- README.md | 14 +++++++------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index a4d0e92..542e8db 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -21,12 +21,11 @@ jobs: fail-fast: false matrix: include: - # macOS x86_64 - arch: x86_64 os: macos-13 - python: "3.8" - link: https://github.com/disintar/ton/releases/download/ton-cpython-38-x86_64-darwin/ - file: python_ton.cpython-38-darwin.so + python: "3.9" + link: https://github.com/disintar/ton/releases/download/ton-cpython-39-x86_64-darwin/ + file: python_ton.cpython-39-darwin.so fix_tag: x86_64 - arch: x86_64 os: macos-13 @@ -68,12 +67,6 @@ jobs: fix_tag: manylinux2014_x86_64 # Legacy Linux x86_64 (arc-runner-set) kept - - arch: x86_64 - os: arc-runner-set - python: "3.8" - link: https://github.com/disintar/ton/releases/download/ton-cpython-38-x86_64-linux/ - file: python_ton.cpython-38-x86_64-linux-gnu.so - fix_tag: manylinux2014_x86_64 - arch: x86_64 os: arc-runner-set python: "3.9" @@ -96,9 +89,9 @@ jobs: # macOS arm64 - arch: aarch64 os: macos-15 - python: "3.8" - link: https://github.com/disintar/ton/releases/download/ton-cpython-38-aarch64-darwin/ - file: python_ton.cpython-38-darwin.so + python: "3.9" + link: https://github.com/disintar/ton/releases/download/ton-cpython-39-aarch64-darwin/ + file: python_ton.cpython-39-darwin.so fix_tag: arm64 - arch: aarch64 os: macos-15 @@ -203,7 +196,7 @@ jobs: - name: Store the binary wheel uses: actions/upload-artifact@v4 with: - name: python-package-distributions-${{ github.run_id }}-${{ matrix.arch }}-${{ matrix.python }} + name: python-package-distributions-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.python }} path: dist # buildVirtualLinux: diff --git a/README.md b/README.md index 52d3b85..435f456 100644 --- a/README.md +++ b/README.md @@ -48,13 +48,13 @@ Documentation can be found on [tonpy.dton.io](https://tonpy.dton.io) ### Supported systems / architectures / Python | System | Architecture | Python versions | CI status | -|:--|:--|:--|:-----------------------| -| 🐧 Linux | `x86_64` | 3.8 – 3.13 | ✅ | -| 🐧 Linux | `aarch64` | 3.8 – 3.13 | ✅ | -| 🍎 macOS | `x86_64` (Intel) | 3.8 – 3.13 | ✅ | -| 🍎 macOS | `aarch64` (Apple Silicon) | 3.8 – 3.13 | ✅ | -| 🪟 Windows | `x86_64` | 3.9 – 3.13 | ✅ | -| 🪟 Windows | `aarch64` | — | ⛔ | +|:--|:--|:----------------|:-----------------------| +| 🐧 Linux | `x86_64` | 3.9 – 3.13 | ✅ | +| 🐧 Linux | `aarch64` | 3.9 – 3.13 | ✅ | +| 🍎 macOS | `x86_64` (Intel) | 3.9 – 3.13 | ✅ | +| 🍎 macOS | `aarch64` (Apple Silicon) | 3.9 – 3.13 | ✅ | +| 🪟 Windows | `x86_64` | 3.9 – 3.13 | ✅ | +| 🪟 Windows | `aarch64` | — | ⛔ | ## Speed compare From 942cb51096773540b43dc4133daa23d74d73ee3f Mon Sep 17 00:00:00 2001 From: Andrey Tvorozhkov Date: Sat, 16 Aug 2025 14:09:15 +0300 Subject: [PATCH 06/11] Use github-hosted runner for docs --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b3f2ddf..aff514a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,7 +20,7 @@ jobs: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} - runs-on: arc-runner-set + runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 From 87a7d3a65ea0d3c3f822d204d4e0b4be9e4380c7 Mon Sep 17 00:00:00 2001 From: Andrey Tvorozhkov Date: Sat, 16 Aug 2025 14:12:25 +0300 Subject: [PATCH 07/11] Remove 3.9 support --- .github/workflows/wheels.yml | 26 +------------------------- README.md | 10 +++++----- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 542e8db..fb02018 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -21,12 +21,6 @@ jobs: fail-fast: false matrix: include: - - arch: x86_64 - os: macos-13 - python: "3.9" - link: https://github.com/disintar/ton/releases/download/ton-cpython-39-x86_64-darwin/ - file: python_ton.cpython-39-darwin.so - fix_tag: x86_64 - arch: x86_64 os: macos-13 python: "3.10" @@ -66,13 +60,7 @@ jobs: file: python_ton.cpython-313-x86_64-linux-gnu.so fix_tag: manylinux2014_x86_64 - # Legacy Linux x86_64 (arc-runner-set) kept - - arch: x86_64 - os: arc-runner-set - python: "3.9" - link: https://github.com/disintar/ton/releases/download/ton-cpython-39-x86_64-linux/ - file: python_ton.cpython-39-x86_64-linux-gnu.so - fix_tag: manylinux2014_x86_64 + # Legacy Linux x86_64 - arch: x86_64 os: arc-runner-set python: "3.10" @@ -87,12 +75,6 @@ jobs: fix_tag: manylinux2014_x86_64 # macOS arm64 - - arch: aarch64 - os: macos-15 - python: "3.9" - link: https://github.com/disintar/ton/releases/download/ton-cpython-39-aarch64-darwin/ - file: python_ton.cpython-39-darwin.so - fix_tag: arm64 - arch: aarch64 os: macos-15 python: "3.10" @@ -119,12 +101,6 @@ jobs: fix_tag: arm64 # Windows x64 - - arch: x86_64 - os: windows-2022 - python: "3.9" - link: https://github.com/disintar/ton/releases/download/ton-cpython-39-x86_64-windows/ - file: python_ton.cp39-win_amd64.pyd - fix_tag: - arch: x86_64 os: windows-2022 python: "3.10" diff --git a/README.md b/README.md index 435f456..a675c5b 100644 --- a/README.md +++ b/README.md @@ -49,11 +49,11 @@ Documentation can be found on [tonpy.dton.io](https://tonpy.dton.io) | System | Architecture | Python versions | CI status | |:--|:--|:----------------|:-----------------------| -| 🐧 Linux | `x86_64` | 3.9 – 3.13 | ✅ | -| 🐧 Linux | `aarch64` | 3.9 – 3.13 | ✅ | -| 🍎 macOS | `x86_64` (Intel) | 3.9 – 3.13 | ✅ | -| 🍎 macOS | `aarch64` (Apple Silicon) | 3.9 – 3.13 | ✅ | -| 🪟 Windows | `x86_64` | 3.9 – 3.13 | ✅ | +| 🐧 Linux | `x86_64` | 3.10 – 3.13 | ✅ | +| 🐧 Linux | `aarch64` | 3.10 – 3.13 | ✅ | +| 🍎 macOS | `x86_64` (Intel) | 3.10 – 3.13 | ✅ | +| 🍎 macOS | `aarch64` (Apple Silicon) | 3.10 – 3.13 | ✅ | +| 🪟 Windows | `x86_64` | 3.10 – 3.13 | ✅ | | 🪟 Windows | `aarch64` | — | ⛔ | From 288953a77cc4320bf983111108761d5803937509 Mon Sep 17 00:00:00 2001 From: Andrey Tvorozhkov Date: Sat, 16 Aug 2025 14:14:01 +0300 Subject: [PATCH 08/11] Use deploy-pages@v4 --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index aff514a..e425860 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -44,4 +44,4 @@ jobs: path: './docs/build/html' - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v2 + uses: actions/deploy-pages@v4 From e887e753250ad0723032f9b96bedc66cfb9fc519 Mon Sep 17 00:00:00 2001 From: Andrey Tvorozhkov Date: Sat, 16 Aug 2025 14:22:13 +0300 Subject: [PATCH 09/11] Fix PyPi token --- .github/workflows/wheels-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels-dev.yml b/.github/workflows/wheels-dev.yml index 8776aec..0608a38 100644 --- a/.github/workflows/wheels-dev.yml +++ b/.github/workflows/wheels-dev.yml @@ -140,4 +140,4 @@ jobs: twine upload dist/* env: TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + TWINE_PASSWORD: ${{ secrets.PYPI_MAIN_API_TOKEN }} From 7b6c0c1d7a45eb026e6d7e1f3a31832700b1a5b9 Mon Sep 17 00:00:00 2001 From: Andrey Tvorozhkov Date: Sat, 16 Aug 2025 14:32:45 +0300 Subject: [PATCH 10/11] Fix PyPi token --- .github/workflows/wheels-dev.yml | 2 +- .github/workflows/wheels.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels-dev.yml b/.github/workflows/wheels-dev.yml index 0608a38..8776aec 100644 --- a/.github/workflows/wheels-dev.yml +++ b/.github/workflows/wheels-dev.yml @@ -140,4 +140,4 @@ jobs: twine upload dist/* env: TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_MAIN_API_TOKEN }} + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index fb02018..16237d6 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -265,4 +265,4 @@ jobs: twine upload dist/* env: TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + TWINE_PASSWORD: ${{ secrets.PYPI_MAIN_API_TOKEN }} From 9628759f8075af917039c4d3c0985a4da83198c8 Mon Sep 17 00:00:00 2001 From: Andrey Tvorozhkov Date: Tue, 19 Aug 2025 20:34:31 +0500 Subject: [PATCH 11/11] Fix prev blocks for emulator in BlockScanner --- setup.py | 2 +- src/tonpy/blockscanner/blockscanner.py | 52 ++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index b8b26ea..50a5e51 100644 --- a/setup.py +++ b/setup.py @@ -31,7 +31,7 @@ def finalize_options(self): setup( name="tonpy" if not IS_DEV else "tonpy-dev", - version="0.0.0.1.3a0" if not IS_DEV else "0.0.0.5.9b1", + version="0.0.0.1.3b0" if not IS_DEV else "0.0.0.5.9c1", author="Disintar LLP", author_email="andrey@head-labs.com", description="Types / API for TON blockchain", diff --git a/src/tonpy/blockscanner/blockscanner.py b/src/tonpy/blockscanner/blockscanner.py index 78d6f81..fc1864c 100644 --- a/src/tonpy/blockscanner/blockscanner.py +++ b/src/tonpy/blockscanner/blockscanner.py @@ -526,6 +526,7 @@ class BlockScanner(Thread): Loads masterchain and shardchain blocks, optionally filters/emulates transactions, and emits results to a queue or a user-provided callback. """ + def __init__(self, lcparams: dict, start_from: int = None, @@ -764,11 +765,35 @@ def prepare_prev_block_data(self, shards_data, mc_data): for i in range(last_mc - 16, last_mc): to_load_masters.append(i) + prev_block_100 = int(last_mc - last_mc % 100) + to_load_by_100 = [] + while len(to_load_by_100) < 16: + to_load_by_100.append(prev_block_100) + if prev_block_100 == 100: + break + + prev_block_100 -= 100 + + to_load_masters.extend(to_load_by_100) + for s in shards_data: - for i in range(s['master'] - 15, s['master'] + 1): + last_mc = s['master'] + prev_block_100 = int(last_mc - last_mc % 100) + to_load_by_100 = [] + + for i in range(last_mc - 15, last_mc + 1): if i not in known_mcs: to_load_masters.append(i) + while len(to_load_by_100) < 16: + to_load_by_100.append(prev_block_100) + if prev_block_100 == 100: + break + + prev_block_100 -= 100 + + to_load_masters.extend(to_load_by_100) + to_load_masters = list(set(to_load_masters)) if self.loglevel > 1: @@ -781,13 +806,26 @@ def prepare_prev_block_data(self, shards_data, mc_data): for x in mc_data: prev_blocks = [] + prev_blocks_100 = [] + + for i in range(x['block_id'].id.seqno - 16, x['block_id'].id.seqno): + prev_blocks.append(known_mcs[i].to_data()) + + prev_100_seqno = int(x['block_id'].id.seqno - x['block_id'].id.seqno % 100) + while len(prev_blocks_100) < 16: + prev_blocks_100.append(known_mcs[prev_100_seqno].to_data()) + if prev_100_seqno == 100: + break + prev_100_seqno -= 100 for i in range(x['block_id'].id.seqno - 16, x['block_id'].id.seqno): prev_blocks.append(known_mcs[i].to_data()) prev_blocks = list(reversed(prev_blocks)) key = self.known_key_blocks[x['prev_key_block_seqno']] - x['prev_block_data'] = [prev_blocks, key['blk_id'].to_data()] + x['prev_block_data'] = [prev_blocks_100, + prev_blocks, + key['blk_id'].to_data()] x['prev_block_left'] = known_mcs[i] x['prev_block_right'] = None x['key_block'] = key @@ -803,11 +841,19 @@ def prepare_prev_block_data(self, shards_data, mc_data): i['prev_block_data'] = known_prev_block_data[i['master']] else: prev_blocks = [] + prev_blocks_100 = [] for j in range(i['master'] - 16, i['master']): prev_blocks.append(known_mcs[j].to_data()) + prev_100_seqno = int(i['master'] - i['master'] % 100) + while len(prev_blocks_100) < 16: + prev_blocks_100.append(known_mcs[prev_100_seqno].to_data()) + if prev_100_seqno == 100: + break + prev_100_seqno -= 100 + prev_blocks = list(reversed(prev_blocks)) - i['prev_block_data'] = [prev_blocks, key['blk_id'].to_data()] + i['prev_block_data'] = [prev_blocks_100, prev_blocks, key['blk_id'].to_data()] known_prev_block_data[i['master']] = i['prev_block_data'] i['master'] -= 1