From a222d8d5835116f346f8030f5045a043c6999242 Mon Sep 17 00:00:00 2001 From: Sven-NOM <122675156+Sven-NOM@users.noreply.github.com> Date: Fri, 3 May 2024 15:01:41 +0200 Subject: [PATCH] Added a check to skip validator status checking on BN Added a check to skip validator status checking when there are no exit requests to map them to. It saves quite some time and resources checking the BN, and running this command (8 mins on Holesky currently). --- programs/exit-bus/exit-requests.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/programs/exit-bus/exit-requests.ts b/programs/exit-bus/exit-requests.ts index a045937..b0c5347 100644 --- a/programs/exit-bus/exit-requests.ts +++ b/programs/exit-bus/exit-requests.ts @@ -79,6 +79,11 @@ export const fetchLastExitRequestsDetailed = async (forBlocks = 7200) => { // fetch exit requests from events on EL const requests = await fetchLastExitRequests(forBlocks, Number(blockNumber)); + // skip validator status check if there are no exit requests + if (requests.length === 0) { + return []; + } + // fetch validator from CL const validators = await fetchAllValidators(Number(slot)); const validatorsMap = getValidatorsMap(validators);