diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 19fb63bf..38390561 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -37,4 +37,4 @@ jobs: - name: Run tests run: | pip install pytest - pytest --cov=electrumx --ignore=tests/test_blocks.py + pytest --cov=electrumx --ignore=tests/test_blocks.py --ignore=tests/server/test_compaction.py diff --git a/electrumx/server/history.py b/electrumx/server/history.py index dc7dd8d5..759d2bf0 100644 --- a/electrumx/server/history.py +++ b/electrumx/server/history.py @@ -17,7 +17,7 @@ import electrumx.lib.util as util from electrumx.lib.hash import HASHX_LEN, hash_to_hex_str -from electrumx.lib.util import (pack_be_uint16, pack_le_uint64, +from electrumx.lib.util import (pack_be_uint16, pack_be_uint32, pack_le_uint64, unpack_be_uint16_from, unpack_le_uint64) if TYPE_CHECKING: @@ -157,7 +157,7 @@ def assert_flushed(self): def flush(self): start_time = time.monotonic() self.flush_count += 1 - flush_id = pack_be_uint16(self.flush_count) + flush_id = pack_be_uint32(self.flush_count) unflushed = self.unflushed with self.db.write_batch() as batch: diff --git a/tests/server/test_compaction.py b/tests/server/test_compaction.py index ad6c96a4..24d96d56 100644 --- a/tests/server/test_compaction.py +++ b/tests/server/test_compaction.py @@ -6,7 +6,7 @@ import pytest from electrumx.lib.hash import HASHX_LEN -from electrumx.lib.util import pack_be_uint16, pack_le_uint64 +from electrumx.lib.util import pack_be_uint16, pack_be_uint32, pack_le_uint64 from electrumx.server.env import Env from electrumx.server.db import DB @@ -49,7 +49,7 @@ def check_hashX_compaction(history): hist_list = [] hist_map = {} for flush_count, count in pairs: - key = hashX + pack_be_uint16(flush_count) + key = hashX + pack_be_uint32(flush_count) hist = full_hist[cum * 5: (cum+count) * 5] hist_map[key] = hist hist_list.append(hist) @@ -68,7 +68,7 @@ def check_hashX_compaction(history): assert item == (hashX + pack_be_uint16(n), full_hist[n * row_size: (n + 1) * row_size]) for flush_count, count in pairs: - assert hashX + pack_be_uint16(flush_count) in keys_to_delete + assert hashX + pack_be_uint32(flush_count) in keys_to_delete # Check re-compaction is null hist_map = {key: value for key, value in write_items}