use array.array to serialize TX_COUNTS_STATE

This commit is contained in:
Jack Robison 2020-12-01 18:43:49 -05:00
parent aa0f49633a
commit 3fff5ccb49
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
2 changed files with 5 additions and 2 deletions

View file

@ -287,6 +287,7 @@ def tx_merkle(tx_num, tx_height):
stop=None if tx_height + 1 == len(tx_counts) else
TX_HASH_PREFIX + util.pack_be_uint64(tx_counts[tx_height] - 1), include_key=False
))
# print("rocks txs", tx_height, list(map(hash_to_hex_str, block_txs)))
if tx_height + 100 <= db_height:
ctx.block_txs_cache[tx_height] = block_txs
else:
@ -595,8 +596,9 @@ class LevelDB:
tx_num += 1
offset += 32
batch_put(TX_COUNTS_STATE, b''.join(map(util.pack_le_int64, self.tx_counts)))
a = array.array('L')
a.fromlist(self.tx_counts)
batch_put(TX_COUNTS_STATE, a.tobytes())
flush_data.block_txs.clear()
flush_data.block_hashes.clear()

View file

@ -1534,6 +1534,7 @@ class LBRYElectrumX(SessionBase):
if block_hash:
block = await self.daemon.deserialised_block(block_hash)
height = block['height']
# print('lbrycrd txs', height, block['tx'])
try:
pos = block['tx'].index(tx_hash)
except ValueError: