Skip to content

Commit

Permalink
don't unwrap in aggregate verify
Browse files Browse the repository at this point in the history
  • Loading branch information
Rigidity committed May 17, 2024
1 parent e5b32b9 commit e224c5d
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions crates/chia-bls/src/cached_bls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,17 @@ impl BLSCache {
msgs: &pyo3::Bound<PyList>,
sig: &Signature,
) -> PyResult<bool> {
let pks_r = pks
.iter()
.unwrap()
.map(|item| item.unwrap().extract::<PublicKey>().unwrap());
let msgs_r = msgs
.iter()
.unwrap()
.map(|item| item.unwrap().extract::<PyBackedBytes>().unwrap());
Ok(self.aggregate_verify(pks_r, msgs_r, sig))
let pks = pks
.iter()?
.map(|item| item?.extract())
.collect::<PyResult<Vec<PublicKey>>>()?;

let msgs = msgs
.iter()?
.map(|item| item?.extract())
.collect::<PyResult<Vec<PyBackedBytes>>>()?;

Ok(self.aggregate_verify(pks, msgs, sig))
}

#[pyo3(name = "len")]
Expand Down

0 comments on commit e224c5d

Please sign in to comment.