mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-02 09:46:26 +00:00
use template to more cleanly implement for_ops
This commit is contained in:
parent
95ee0218db
commit
67ba11cc1a
@ -324,23 +324,19 @@ proc process_operations(state: var BeaconState, body: BeaconBlockBody,
|
|||||||
deposit_index = state.eth1_deposit_index
|
deposit_index = state.eth1_deposit_index
|
||||||
return false
|
return false
|
||||||
|
|
||||||
proc for_ops(state: var BeaconState, operations: auto, fn: auto, flags: auto,
|
template for_ops_cached(operations: auto, fn: auto) =
|
||||||
stateCache: var auto) =
|
|
||||||
for operation in operations:
|
for operation in operations:
|
||||||
discard fn(state, operation, flags, stateCache)
|
discard fn(state, operation, flags, stateCache)
|
||||||
|
|
||||||
proc for_ops(
|
template for_ops(operations: auto, fn: auto) =
|
||||||
state: var BeaconState, operations: auto, fn: auto, flags: auto) =
|
|
||||||
for operation in operations:
|
for operation in operations:
|
||||||
discard fn(state, operation, flags)
|
discard fn(state, operation, flags)
|
||||||
|
|
||||||
for_ops(state, body.proposer_slashings, process_proposer_slashing, flags,
|
for_ops_cached(body.proposer_slashings, process_proposer_slashing)
|
||||||
stateCache)
|
for_ops_cached(body.attester_slashings, process_attester_slashing)
|
||||||
for_ops(state, body.attester_slashings, process_attester_slashing, flags,
|
for_ops_cached(body.attestations, process_attestation)
|
||||||
stateCache)
|
for_ops(body.deposits, process_deposit)
|
||||||
for_ops(state, body.attestations, process_attestation, flags, stateCache)
|
for_ops(body.voluntary_exits, process_voluntary_exit)
|
||||||
for_ops(state, body.deposits, process_deposit, flags)
|
|
||||||
for_ops(state, body.voluntary_exits, process_voluntary_exit, flags)
|
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user