From 127108165eaee5aced9023b826b17ef855a1085b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mamy=20Andr=C3=A9-Ratsimbazafy?= Date: Thu, 21 Jan 2021 14:43:49 +0100 Subject: [PATCH] address https://github.com/status-im/nimbus-eth2/pull/2250#discussion_r561819858 --- beacon_chain/spec/signatures_batch.nim | 36 +++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/beacon_chain/spec/signatures_batch.nim b/beacon_chain/spec/signatures_batch.nim index 9aeb852c33..a3f245f9fb 100644 --- a/beacon_chain/spec/signatures_batch.nim +++ b/beacon_chain/spec/signatures_batch.nim @@ -35,26 +35,26 @@ func addSignatureSet[T]( ## Add a new signature set triplet (pubkey, message, signature) ## to a collection of signature sets for batch verification. ## Can return false if `signature` wasn't deserialized to a valid BLS signature. - try: - let signing_root = compute_signing_root( - sszObj, - get_domain( - state.fork, domain, - epoch, - state.genesis_validators_root - ) - ).data - - sigs.add(( - pubkey, - signing_root, - signature.blsValue - )) - - return true - except FieldError: # bad discriminant when accessing signature.blsValue + if signature.kind != Real: return false + let signing_root = compute_signing_root( + sszObj, + get_domain( + state.fork, domain, + epoch, + state.genesis_validators_root + ) + ).data + + sigs.add(( + pubkey, + signing_root, + signature.blsValue + )) + + return true + proc aggregateAttesters( attestation: IndexedAttestation, state: BeaconState