remove outdated hash cache, use less memory
This commit is contained in:
parent
e9d887be4d
commit
230e5ce345
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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue