mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-11 06:46:10 +00:00
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:
parent
4570f6e4ec
commit
eb777a6c8b
@ -74,11 +74,12 @@ template withState*(
|
|||||||
## TODO async transformations will lead to a race where stateData gets updated
|
## TODO async transformations will lead to a race where stateData gets updated
|
||||||
## while waiting for future to complete - catch this here somehow?
|
## while waiting for future to complete - catch this here somehow?
|
||||||
|
|
||||||
var cache {.inject.} = StateCache()
|
block:
|
||||||
updateStateData(dag, stateData, blockSlot, false, cache)
|
var cache {.inject.} = StateCache()
|
||||||
|
updateStateData(dag, stateData, blockSlot, false, cache)
|
||||||
|
|
||||||
withStateVars(stateData):
|
withStateVars(stateData):
|
||||||
body
|
body
|
||||||
|
|
||||||
func parent*(bs: BlockSlot): BlockSlot =
|
func parent*(bs: BlockSlot): BlockSlot =
|
||||||
## Return a blockslot representing the previous slot, using the parent block
|
## Return a blockslot representing the previous slot, using the parent block
|
||||||
|
Loading…
x
Reference in New Issue
Block a user