mirror of
https://github.com/ethereum/consensus-specs.git
synced 2026-02-02 04:25:12 -05:00
remove outdated hash cache, use less memory
This commit is contained in:
11
setup.py
11
setup.py
@@ -141,11 +141,6 @@ def ceillog2(x: uint64) -> int:
|
||||
return (x - 1).bit_length()
|
||||
'''
|
||||
PHASE0_SUNDRY_FUNCTIONS = '''
|
||||
# Monkey patch hash cache
|
||||
_hash = hash
|
||||
hash_cache: Dict[bytes, Bytes32] = {}
|
||||
|
||||
|
||||
def get_eth1_data(block: Eth1Block) -> Eth1Data:
|
||||
"""
|
||||
A stub function return mocking Eth1Data.
|
||||
@@ -156,12 +151,6 @@ def get_eth1_data(block: Eth1Block) -> Eth1Data:
|
||||
block_hash=hash_tree_root(block))
|
||||
|
||||
|
||||
def hash(x: bytes) -> Bytes32: # type: ignore
|
||||
if x not in hash_cache:
|
||||
hash_cache[x] = Bytes32(_hash(x))
|
||||
return hash_cache[x]
|
||||
|
||||
|
||||
def cache_this(key_fn, value_fn, lru_size): # type: ignore
|
||||
cache_dict = LRU(size=lru_size)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user