fix cache for config change during runtime

This commit is contained in:
protolambda 2020-05-19 02:46:27 +02:00
parent 75a0d60eb3
commit 97e54b85d6
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
1 changed files with 3 additions and 2 deletions

View File

@ -78,8 +78,9 @@ def with_custom_state(balances_fn: Callable[[Any], Sequence[int]],
def deco(fn):
def entry(*args, spec: Spec, phases: SpecForks, **kw):
# Use fork and file path to make a key for th
key = (spec.fork, spec.__file__, balances_fn, threshold_fn)
# make a key for the state
# genesis fork version separates configs during test-generation runtime.
key = (spec.fork, spec.GENESIS_FORK_VERSION, spec.__file__, balances_fn, threshold_fn)
global _custom_state_cache_dict
if key not in _custom_state_cache_dict:
state = _prepare_state(balances_fn, threshold_fn, spec, phases)