Skip to content

Commit 8c9d728

Browse files
committed
refactor: fix vrfproof::from_slice
1 parent 2dbc778 commit 8c9d728

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

stacks-common/src/util/vrf.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,14 @@ impl VRFProof {
299299

300300
c_buf[..16].copy_from_slice(&bytes[32..(16 + 32)]);
301301
s_buf[..32].copy_from_slice(&bytes[48..(32 + 48)]);
302-
let c = ed25519_Scalar::from_canonical_bytes(c_buf).ok()?;
303-
let s = ed25519_Scalar::from_canonical_bytes(s_buf).ok()?;
304-
305-
Some(VRFProof { Gamma: gamma, c, s })
302+
let c: Option<ed25519_Scalar> = ed25519_Scalar::from_canonical_bytes(c_buf).into();
303+
let s: Option<ed25519_Scalar> = ed25519_Scalar::from_canonical_bytes(s_buf).into();
304+
305+
Some(VRFProof {
306+
Gamma: gamma,
307+
c: c?,
308+
s: s?,
309+
})
306310
}
307311
_ => None,
308312
}

0 commit comments

Comments
 (0)