@@ -262,12 +262,12 @@ impl<T: TreeIndex> SecretTree<T> {
262262
263263        let  res = ratchet
264264            . message_key_generation ( cipher_suite,  generation,  key_type) 
265-             . await ? ; 
265+             . await ; 
266266
267267        self . known_secrets 
268268            . set_node ( leaf_index,  SecretTreeNode :: Ratchet ( ratchet) ) ; 
269269
270-         Ok ( res) 
270+         res
271271    } 
272272} 
273273
@@ -808,6 +808,30 @@ mod tests {
808808        ) 
809809    } 
810810
811+     #[ maybe_async:: test( not( mls_build_async) ,  async ( mls_build_async,  crate :: futures_test) ) ]  
812+     async  fn  double_hit_leaves_epoch_intact ( )  { 
813+         let  cs = test_cipher_suite_provider ( TEST_CIPHER_SUITE ) ; 
814+         let  test_secret = vec ! [ 0u8 ;  cs. kdf_extract_size( ) ] ; 
815+         let  mut  test_tree = get_test_tree ( test_secret,  4u32 ) ; 
816+         let  key_type = KeyType :: Application ; 
817+ 
818+         // We receive a ciphertext from leaf 2 (node 4) 
819+         test_tree
820+             . message_key_generation ( & cs,  4 ,  key_type,  0 ) 
821+             . await 
822+             . unwrap ( ) ; 
823+ 
824+         // Due to a double hit we receive that ciphertext again 
825+         let  res = test_tree. message_key_generation ( & cs,  4 ,  key_type,  0 ) . await ; 
826+         assert_matches ! ( res,  Err ( MlsError :: KeyMissing ( 0 ) ) ) ; 
827+ 
828+         // We receive another ciphertext from leaf 2 
829+         test_tree
830+             . message_key_generation ( & cs,  4 ,  key_type,  1 ) 
831+             . await 
832+             . unwrap ( ) ; 
833+     } 
834+ 
811835    #[ derive( Debug ,  PartialEq ,  serde:: Serialize ,  serde:: Deserialize ) ]  
812836    struct  Ratchet  { 
813837        application_keys :  Vec < Vec < u8 > > , 
0 commit comments