fix flush id

This commit is contained in:
Jack Robison 2021-06-06 13:06:30 -04:00
parent 1bdaddb319
commit 1b325b9acd
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -540,7 +540,7 @@ class LevelDB:
keys = [] keys = []
for key, hist in self.db.iterator(prefix=DB_PREFIXES.HASHX_HISTORY_PREFIX.value): for key, hist in self.db.iterator(prefix=DB_PREFIXES.HASHX_HISTORY_PREFIX.value):
k = key[1:] k = key[1:]
flush_id, = unpack_be_uint16_from(k[-2:]) flush_id = int.from_bytes(k[-4:], byteorder='big')
if flush_id > self.utxo_flush_count: if flush_id > self.utxo_flush_count:
keys.append(k) keys.append(k)
@ -719,7 +719,7 @@ class LevelDB:
# Then history # Then history
self.hist_flush_count += 1 self.hist_flush_count += 1
flush_id = pack_be_uint16(self.hist_flush_count) flush_id = util.pack_be_uint32(self.hist_flush_count)
unflushed = self.hist_unflushed unflushed = self.hist_unflushed
for hashX in sorted(unflushed): for hashX in sorted(unflushed):