@@ -698,16 +698,18 @@ impl Worker {
698
698
} ;
699
699
700
700
let guard = self . key_stores . read ( ) ;
701
- let Some ( key_store) = guard. get ( res. committee_id ) else {
702
- return Err ( DecrypterError :: NoCommittee ( res. committee_id ) ) ;
703
- } ;
704
- key_store
701
+ let current = guard
702
+ . get ( res. committee_id )
703
+ . ok_or ( DecrypterError :: NoCommittee ( res. committee_id ) ) ?;
704
+
705
+ let prev = ( guard. len ( ) == 2 ) . then ( || guard. last ( ) . clone ( ) ) ;
706
+ current
705
707
. committee ( )
706
708
. get_index ( & src)
707
709
. ok_or_else ( || DecrypterError :: UnknownKey ( src) ) ?;
708
710
709
711
subsets. insert ( src, res. subset . to_owned ( ) ) ;
710
- let committee = key_store . committee ( ) ;
712
+ let committee = current . committee ( ) ;
711
713
let threshold: usize = committee. one_honest_threshold ( ) . into ( ) ;
712
714
713
715
let mut counts = HashMap :: new ( ) ;
@@ -716,9 +718,9 @@ impl Worker {
716
718
}
717
719
718
720
if let Some ( ( & subset, _) ) = counts. iter ( ) . find ( |( _, count) | * * count >= threshold) {
719
- let acc = DkgAccumulator :: from_subset ( key_store . to_owned ( ) , subset. to_owned ( ) ) ;
721
+ let acc = DkgAccumulator :: from_subset ( current . to_owned ( ) , subset. to_owned ( ) ) ;
720
722
let dec_key = acc
721
- . extract_key ( & self . dkg_sk , None )
723
+ . extract_key ( & self . dkg_sk , prev )
722
724
. map_err ( |e| DecrypterError :: Dkg ( e. to_string ( ) ) ) ?;
723
725
self . tracker . insert ( committee. id ( ) , acc) ;
724
726
0 commit comments