From 558ca85799cf3a2c3c304244b6da839b3b382a11 Mon Sep 17 00:00:00 2001 From: tersec Date: Thu, 6 Apr 2023 07:45:06 +0000 Subject: [PATCH] only add active validators to knownValidators at startup --- beacon_chain/nimbus_beacon_node.nim | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/beacon_chain/nimbus_beacon_node.nim b/beacon_chain/nimbus_beacon_node.nim index 8b481a68f1..280fad9326 100644 --- a/beacon_chain/nimbus_beacon_node.nim +++ b/beacon_chain/nimbus_beacon_node.nim @@ -414,8 +414,13 @@ proc initFullNode( node.validatorMonitor[].addMonitor(validator.pubkey, validator.index) if validator.index.isSome(): - node.consensusManager[].actionTracker.knownValidators[ - validator.index.get()] = wallSlot + withState(dag.headState): + let idx = validator.index.get() + if distinctBase(idx) <= forkyState.data.validators.lenu64: + template v: auto = forkyState.data.validators.item(idx) + if is_active_validator(v, wallSlot.epoch) or + is_active_validator(v, wallSlot.epoch + 1): + node.consensusManager[].actionTracker.knownValidators[idx] = wallSlot let stabilitySubnets = node.consensusManager[].actionTracker.stabilitySubnets(wallSlot) # Here, we also set the correct ENR should we be in all subnets mode!