From a0d27b4fda7bb18679ff236cfecd0bd44a9b842c Mon Sep 17 00:00:00 2001 From: chad Date: Mon, 20 Mar 2023 22:01:27 -0500 Subject: [PATCH] Fix added updated catch for unknown fee recipient in tests (#5158) --- packages/validator/src/validator.ts | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/validator/src/validator.ts b/packages/validator/src/validator.ts index f4566a04f2b8..b935c3fe6365 100644 --- a/packages/validator/src/validator.ts +++ b/packages/validator/src/validator.ts @@ -164,15 +164,21 @@ export class Validator { const validatorKeys = this.validatorStore.getValidatorKeys(); - if (validatorKeys.length > 0) { - for (const pubkeyHex in validatorKeys) { - if (!indicesService.validatorPubKeyExists(pubkeyHex)) { - this.logger.info("Validator exists in beacon chain", { - index: validatorStore.getIndexOfPubkey(pubkeyHex), - pubKey: prettyBytes(pubkeyHex), - feeRecipient: validatorStore.getFeeRecipient(pubkeyHex), - }); - } + for (const pubkeyHex in validatorKeys) { + let feeRecipient = ""; + + try { + feeRecipient = validatorStore.getFeeRecipient(pubkeyHex); + } catch (e) { + this.logger.warn("Cannot retrieve Fee Recipient", {}, e as Error); + } + + if (!indicesService.validatorPubKeyExists(pubkeyHex)) { + this.logger.info("Validator exists in beacon chain", { + index: validatorStore.getIndexOfPubkey(pubkeyHex), + pubKey: prettyBytes(pubkeyHex), + feeRecipient, + }); } }