allow `withState` to be called multiple times

This allows `blockchain_dag`'s `withState` template to be called more
than once in a single function. This led to a compilation error before
because the injected variables and functions shared the same scope.
This commit is contained in:
Etan Kissling 2021-11-29 11:25:47 +01:00 committed by zah
parent 4570f6e4ec
commit eb777a6c8b
1 changed files with 5 additions and 4 deletions

View File

@ -74,6 +74,7 @@ template withState*(
## TODO async transformations will lead to a race where stateData gets updated
## while waiting for future to complete - catch this here somehow?
block:
var cache {.inject.} = StateCache()
updateStateData(dag, stateData, blockSlot, false, cache)