diff --git a/beacon_chain/nimbus_light_client.nim b/beacon_chain/nimbus_light_client.nim index 1609ff7da..59812bd14 100644 --- a/beacon_chain/nimbus_light_client.nim +++ b/beacon_chain/nimbus_light_client.nim @@ -150,31 +150,14 @@ programMain: info "Listening to incoming network requests" network.initBeaconSync(cfg, forkDigests, genesisBlockRoot, getBeaconTime) - 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 = - toValidationResult( - optimisticProcessor.processSignedBeaconBlock(signedBlock))) + withAll(ConsensusFork): + let forkDigest = forkDigests[].atConsensusFork(consensusFork) + network.addValidator( + getBeaconBlocksTopic(forkDigest), proc ( + signedBlock: consensusFork.SignedBeaconBlock + ): ValidationResult = + toValidationResult( + optimisticProcessor.processSignedBeaconBlock(signedBlock))) lightClient.installMessageValidators() waitFor network.startListening() waitFor network.start()