|
@@ -294,4 +294,25 @@ mod tests {
|
|
|
assert!(recres.is_ok());
|
|
|
assert_eq!(recres.unwrap(), s);
|
|
|
}
|
|
|
+
|
|
|
+ #[test]
|
|
|
+ fn share_update_valid_multiple_updates() {
|
|
|
+ let s = Secret::from(42u32);
|
|
|
+
|
|
|
+ let res = generate_shares(s, 5, 2);
|
|
|
+ assert!(res.is_ok());
|
|
|
+ let (com, shares) = res.unwrap();
|
|
|
+
|
|
|
+ for _ in 0..5 {
|
|
|
+ let update_res = update_shares(&com, &shares);
|
|
|
+ assert!(update_res.is_ok());
|
|
|
+ let (update_com, update_shares) = update_res.unwrap();
|
|
|
+
|
|
|
+ for share in update_shares {
|
|
|
+ let is_valid = verify_share(share, &update_com);
|
|
|
+ assert!(is_valid.is_ok());
|
|
|
+ assert!(is_valid.unwrap());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|