diff --git a/src/descriptor/sortedmulti.rs b/src/descriptor/sortedmulti.rs index b63b8edcc..3e21091be 100644 --- a/src/descriptor/sortedmulti.rs +++ b/src/descriptor/sortedmulti.rs @@ -46,7 +46,7 @@ impl SortedMultiVec { pub fn new(k: usize, pks: Vec) -> Result { // A sortedmulti() is only defined for <= 20 keys (it maps to CHECKMULTISIG) if pks.len() > MAX_PUBKEYS_PER_MULTISIG { - Error::BadDescriptor("Too many public keys".to_string()); + return Err(Error::BadDescriptor("Too many public keys".to_string())); } // Check the limits before creating a new SortedMultiVec @@ -237,3 +237,34 @@ impl fmt::Display for SortedMultiVec, Error> = SortedMultiVec::new(0, pks); + let error = res.err().expect("constructor should err"); + + match error { + Error::BadDescriptor(_) => {} // ok + other => panic!("unexpected error: {:?}", other), + } + } +}