commit 41e00449f88eb56fd55b30db25b61b7ac0e8f095
parent 7ff4e8faa087dbcb3a1d91fb2fb5b8cad83785e5
Author: lash <dev@holbrook.no>
Date: Sat, 19 Mar 2022 01:03:49 +0000
correct serialization on next block in sync item
Diffstat:
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/chainsyncer/store/fs.py b/chainsyncer/store/fs.py
@@ -64,8 +64,7 @@ class SyncFsItem:
def next(self, advance_block=False):
v = self.sync_state.get(self.state_key)
- block_number = int.from_bytes(v[:4], 'big')
- tx_index = int.from_bytes(v[4:], 'big')
+ (block_number, tx_index, target) = sync_state_deserialize(v)
if advance_block:
block_number += 1
tx_index = 0
@@ -77,8 +76,8 @@ class SyncFsItem:
self.cursor = block_number
self.tx_cursor = tx_index
- v = block_number.to_bytes(4, 'big')
- self.sync_state.replace(self.state_key, v)
+ b = sync_state_serialize(block_number, tx_index, target)
+ self.sync_state.replace(self.state_key, b)
def __find_advance(self):