From 3c11a91f7778b57a12830f443e2cbe12b70431a6 Mon Sep 17 00:00:00 2001 From: Greg Fitzgerald Date: Fri, 11 May 2018 21:01:07 -0600 Subject: [PATCH] Cleanup verifier error handling --- src/tpu.rs | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/tpu.rs b/src/tpu.rs index d701e1590d..d2be36783b 100644 --- a/src/tpu.rs +++ b/src/tpu.rs @@ -129,18 +129,9 @@ impl Tpu { }) } - fn verify_batch( - batch: Vec, - sendr: &Arc)>>>>, - ) -> Result<()> { + fn verify_batch(batch: Vec) -> Vec<(SharedPackets, Vec)> { let r = ecdsa::ed25519_verify(&batch); - let res = batch.into_iter().zip(r).collect(); - sendr - .lock() - .expect("lock in fn verify_batch in tpu") - .send(res)?; - // TODO: fix error handling here? - Ok(()) + batch.into_iter().zip(r).collect() } fn verifier( @@ -160,7 +151,11 @@ impl Tpu { rand_id ); - Self::verify_batch(batch, sendr).expect("verify_batch in fn verifier"); + let verified_batch = Self::verify_batch(batch); + sendr + .lock() + .expect("lock in fn verify_batch in tpu") + .send(verified_batch)?; let total_time_ms = timing::duration_as_ms(&now.elapsed()); let total_time_s = timing::duration_as_s(&now.elapsed());