mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-10 22:36:01 +00:00
simplify getBlockSSZ
and getBlockSZ
implementation (#5521)
Use `forks` sugar to reduce code duplication in `beacon_chain_db.nim`.
This commit is contained in:
parent
513c9d9637
commit
468ee6a7ed
@ -1038,17 +1038,8 @@ proc getBlockSSZ*[
|
|||||||
proc getBlockSSZ*(
|
proc getBlockSSZ*(
|
||||||
db: BeaconChainDB, key: Eth2Digest, data: var seq[byte],
|
db: BeaconChainDB, key: Eth2Digest, data: var seq[byte],
|
||||||
fork: ConsensusFork): bool =
|
fork: ConsensusFork): bool =
|
||||||
case fork
|
withConsensusFork(fork):
|
||||||
of ConsensusFork.Phase0:
|
getBlockSSZ(db, key, data, consensusFork.TrustedSignedBeaconBlock)
|
||||||
getBlockSSZ(db, key, data, phase0.TrustedSignedBeaconBlock)
|
|
||||||
of ConsensusFork.Altair:
|
|
||||||
getBlockSSZ(db, key, data, altair.TrustedSignedBeaconBlock)
|
|
||||||
of ConsensusFork.Bellatrix:
|
|
||||||
getBlockSSZ(db, key, data, bellatrix.TrustedSignedBeaconBlock)
|
|
||||||
of ConsensusFork.Capella:
|
|
||||||
getBlockSSZ(db, key, data, capella.TrustedSignedBeaconBlock)
|
|
||||||
of ConsensusFork.Deneb:
|
|
||||||
getBlockSSZ(db, key, data, deneb.TrustedSignedBeaconBlock)
|
|
||||||
|
|
||||||
proc getBlobSidecarSZ*(db: BeaconChainDB, root: Eth2Digest, index: BlobIndex,
|
proc getBlobSidecarSZ*(db: BeaconChainDB, root: Eth2Digest, index: BlobIndex,
|
||||||
data: var seq[byte]):
|
data: var seq[byte]):
|
||||||
@ -1091,17 +1082,8 @@ proc getBlockSZ*[
|
|||||||
proc getBlockSZ*(
|
proc getBlockSZ*(
|
||||||
db: BeaconChainDB, key: Eth2Digest, data: var seq[byte],
|
db: BeaconChainDB, key: Eth2Digest, data: var seq[byte],
|
||||||
fork: ConsensusFork): bool =
|
fork: ConsensusFork): bool =
|
||||||
case fork
|
withConsensusFork(fork):
|
||||||
of ConsensusFork.Phase0:
|
getBlockSZ(db, key, data, consensusFork.TrustedSignedBeaconBlock)
|
||||||
getBlockSZ(db, key, data, phase0.TrustedSignedBeaconBlock)
|
|
||||||
of ConsensusFork.Altair:
|
|
||||||
getBlockSZ(db, key, data, altair.TrustedSignedBeaconBlock)
|
|
||||||
of ConsensusFork.Bellatrix:
|
|
||||||
getBlockSZ(db, key, data, bellatrix.TrustedSignedBeaconBlock)
|
|
||||||
of ConsensusFork.Capella:
|
|
||||||
getBlockSZ(db, key, data, capella.TrustedSignedBeaconBlock)
|
|
||||||
of ConsensusFork.Deneb:
|
|
||||||
getBlockSZ(db, key, data, deneb.TrustedSignedBeaconBlock)
|
|
||||||
|
|
||||||
proc getStateOnlyMutableValidators(
|
proc getStateOnlyMutableValidators(
|
||||||
immutableValidators: openArray[ImmutableValidatorData2],
|
immutableValidators: openArray[ImmutableValidatorData2],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user