Skip to content

Commit cd0b3d2

Browse files
committed
resolve comments
1 parent bebf9ba commit cd0b3d2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

ethereum/pow/ethpow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def hashimoto_slow(
3636
hashimoto = hashimoto_slow
3737
elif ETHASH_LIB == "pyethash":
3838

39-
@lru_cache(2)
39+
@lru_cache(10)
4040
def calculate_cache(n):
4141
return pyethash.mkcache_bytes(n * EPOCH_LENGTH)
4242

quarkchain/cluster/shard_db_operator.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,11 @@ def put_minor_block(self, m_block, x_shard_receive_tx_list):
332332
self.height_to_minor_block_hashes.setdefault(m_block.header.height, set()).add(
333333
m_block.header.get_hash()
334334
)
335+
336+
# remove the oldest minor block hash from the height_to_minor_block_hashes
337+
# if the height is greater than 4096
338+
# this is to prevent the height_to_minor_block_hashes from growing indefinitely
339+
# and to keep the memory usage in check
335340
if m_block.header.height - 4096 in self.height_to_minor_block_hashes:
336341
del self.height_to_minor_block_hashes[
337342
m_block.header.height - 4096

0 commit comments

Comments
 (0)