use array.array to serialize TX_COUNTS_STATE
This commit is contained in:
parent
aa0f49633a
commit
3fff5ccb49
2 changed files with 5 additions and 2 deletions
|
@ -287,6 +287,7 @@ def tx_merkle(tx_num, tx_height):
|
||||||
stop=None if tx_height + 1 == len(tx_counts) else
|
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
|
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:
|
if tx_height + 100 <= db_height:
|
||||||
ctx.block_txs_cache[tx_height] = block_txs
|
ctx.block_txs_cache[tx_height] = block_txs
|
||||||
else:
|
else:
|
||||||
|
@ -595,8 +596,9 @@ class LevelDB:
|
||||||
tx_num += 1
|
tx_num += 1
|
||||||
offset += 32
|
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_txs.clear()
|
||||||
flush_data.block_hashes.clear()
|
flush_data.block_hashes.clear()
|
||||||
|
|
|
@ -1534,6 +1534,7 @@ class LBRYElectrumX(SessionBase):
|
||||||
if block_hash:
|
if block_hash:
|
||||||
block = await self.daemon.deserialised_block(block_hash)
|
block = await self.daemon.deserialised_block(block_hash)
|
||||||
height = block['height']
|
height = block['height']
|
||||||
|
# print('lbrycrd txs', height, block['tx'])
|
||||||
try:
|
try:
|
||||||
pos = block['tx'].index(tx_hash)
|
pos = block['tx'].index(tx_hash)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
|
Loading…
Add table
Reference in a new issue