From 73b6c0cc94b60cbfc969df762bbe84ddbdf9226f Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 29 Nov 2024 11:16:32 +0100 Subject: [PATCH] Use ternary operator instead of if-else --- .../src/chain/validation/attestation.ts | 33 ++++++++----------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/packages/beacon-node/src/chain/validation/attestation.ts b/packages/beacon-node/src/chain/validation/attestation.ts index bfe9e540d9c..f2699c14d57 100644 --- a/packages/beacon-node/src/chain/validation/attestation.ts +++ b/packages/beacon-node/src/chain/validation/attestation.ts @@ -515,25 +515,20 @@ async function validateAttestationNoSignatureCheck( signature, }; - let attestation: SingleAttestation; - if (attestationOrCache.attestation) { - attestation = attestationOrCache.attestation; - } else { - if (!isForkPostElectra(fork)) { - attestation = { - aggregationBits, - data: attData, - signature, - }; - } else { - attestation = { - committeeIndex, - attesterIndex: validatorIndex, - data: attData, - signature, - }; - } - } + const attestation: SingleAttestation = attestationOrCache.attestation + ? attestationOrCache.attestation + : !isForkPostElectra(fork) + ? { + aggregationBits, + data: attData, + signature, + } + : { + committeeIndex, + attesterIndex: validatorIndex, + data: attData, + signature, + }; return { attestation,