Make keystore return None when a key doesn't exist (#8163)

* Make keystore return `None` when a key doesn't exist

* Fixes

* More fixes

* Update comment

* Update primitives/keystore/src/lib.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Update client/keystore/src/local.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

* Address comments

* Update client/keystore/src/local.rs

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>

Co-authored-by: André Silva <123550+andresilva@users.noreply.github.com>
This commit is contained in:
Bastian Köcher
2021-02-22 15:24:09 +01:00
committed by GitHub
parent ecf4404903
commit 4f4a0c5b38
12 changed files with 174 additions and 118 deletions
@@ -159,7 +159,7 @@ fn claim_secondary_slot(
authority_id.as_ref(),
transcript_data,
);
if let Ok(signature) = result {
if let Ok(Some(signature)) = result {
Some(PreDigest::SecondaryVRF(SecondaryVRFPreDigest {
slot,
vrf_output: VRFOutput(signature.output),
@@ -265,7 +265,7 @@ fn claim_primary_slot(
authority_id.as_ref(),
transcript_data,
);
if let Ok(signature) = result {
if let Ok(Some(signature)) = result {
let public = PublicKey::from_bytes(&authority_id.to_raw_vec()).ok()?;
let inout = match signature.output.attach_input_hash(&public, transcript) {
Ok(inout) => inout,