From 4c15730c64480e0cfcd830decade321a54839251 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Tue, 30 Nov 2021 10:48:56 +0200 Subject: [PATCH] Minor cleanup around secret key --- crates/sc-consensus-subspace/src/slot_worker.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/crates/sc-consensus-subspace/src/slot_worker.rs b/crates/sc-consensus-subspace/src/slot_worker.rs index ff8a1a83a9217..1827dbdcae6a3 100644 --- a/crates/sc-consensus-subspace/src/slot_worker.rs +++ b/crates/sc-consensus-subspace/src/slot_worker.rs @@ -235,8 +235,6 @@ where } }; - let secret_key = SecretKey::from_bytes(&secret_key).ok()?; - match verification::verify_solution::( &solution, verification::VerifySolutionParams { @@ -253,7 +251,10 @@ where Ok(_) => { debug!(target: "subspace", "Claimed slot {}", slot); - return Some((PreDigest { solution, slot }, secret_key.into())); + return Some(( + PreDigest { solution, slot }, + SecretKey::from_bytes(&secret_key).ok()?.into(), + )); } Err(error) => { warn!(target: "subspace", "Invalid solution received for slot {}: {:?}", slot, error);