Skip to content

Commit

Permalink
Use ternary operator instead of if-else
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Nov 29, 2024
1 parent bdaf3b0 commit 73b6c0c
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions packages/beacon-node/src/chain/validation/attestation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 73b6c0c

Please sign in to comment.