Skip to content

Commit 97b65f7

Browse files
sisoujsdanielh
authored andcommitted
Return an error instead of panicking
This was a copy-paste oversight from the multisig app.
1 parent f8909a5 commit 97b65f7

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

web-client/src/multisig/commitment.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,13 @@ impl Commitment {
6565
data: &[u8],
6666
) -> Result<Commitment, JsError> {
6767
let public_keys = PublicKey::unpack_public_keys(public_keys)?;
68-
6968
let commitment_groups = Commitment::unpack_commitments_list(commitment_groups)?;
7069

71-
assert_eq!(public_keys.len(), commitment_groups.len());
70+
if public_keys.len() != commitment_groups.len() {
71+
return Err(JsError::new(
72+
"The number of public keys must match the number of commitment groups",
73+
));
74+
}
7275

7376
// Pack commitments into compile-time-known groups of MUSIG2_PARAMETER_V
7477
let mut commitment_pairs: Vec<

0 commit comments

Comments
 (0)