mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-14 00:29:04 +00:00
use forks
sugar in nimbus_light_client
(#5653)
Reduce code duplication and maintenance burden by using `withAll` sugar.
This commit is contained in:
parent
91029ce6d6
commit
483e70d7a0
@ -150,29 +150,12 @@ programMain:
|
||||
|
||||
info "Listening to incoming network requests"
|
||||
network.initBeaconSync(cfg, forkDigests, genesisBlockRoot, getBeaconTime)
|
||||
withAll(ConsensusFork):
|
||||
let forkDigest = forkDigests[].atConsensusFork(consensusFork)
|
||||
network.addValidator(
|
||||
getBeaconBlocksTopic(forkDigests.phase0),
|
||||
proc (signedBlock: phase0.SignedBeaconBlock): ValidationResult =
|
||||
toValidationResult(
|
||||
optimisticProcessor.processSignedBeaconBlock(signedBlock)))
|
||||
network.addValidator(
|
||||
getBeaconBlocksTopic(forkDigests.altair),
|
||||
proc (signedBlock: altair.SignedBeaconBlock): ValidationResult =
|
||||
toValidationResult(
|
||||
optimisticProcessor.processSignedBeaconBlock(signedBlock)))
|
||||
network.addValidator(
|
||||
getBeaconBlocksTopic(forkDigests.bellatrix),
|
||||
proc (signedBlock: bellatrix.SignedBeaconBlock): ValidationResult =
|
||||
toValidationResult(
|
||||
optimisticProcessor.processSignedBeaconBlock(signedBlock)))
|
||||
network.addValidator(
|
||||
getBeaconBlocksTopic(forkDigests.capella),
|
||||
proc (signedBlock: capella.SignedBeaconBlock): ValidationResult =
|
||||
toValidationResult(
|
||||
optimisticProcessor.processSignedBeaconBlock(signedBlock)))
|
||||
network.addValidator(
|
||||
getBeaconBlocksTopic(forkDigests.deneb),
|
||||
proc (signedBlock: deneb.SignedBeaconBlock): ValidationResult =
|
||||
getBeaconBlocksTopic(forkDigest), proc (
|
||||
signedBlock: consensusFork.SignedBeaconBlock
|
||||
): ValidationResult =
|
||||
toValidationResult(
|
||||
optimisticProcessor.processSignedBeaconBlock(signedBlock)))
|
||||
lightClient.installMessageValidators()
|
||||
|
Loading…
x
Reference in New Issue
Block a user