Skip to content

Commit 9f8c3fa

Browse files
committed
Introduce catch-up support even after resharing.
1 parent ae215ab commit 9f8c3fa

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

timeboost-sequencer/src/decrypt.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -698,16 +698,18 @@ impl Worker {
698698
};
699699

700700
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
705707
.committee()
706708
.get_index(&src)
707709
.ok_or_else(|| DecrypterError::UnknownKey(src))?;
708710

709711
subsets.insert(src, res.subset.to_owned());
710-
let committee = key_store.committee();
712+
let committee = current.committee();
711713
let threshold: usize = committee.one_honest_threshold().into();
712714

713715
let mut counts = HashMap::new();
@@ -716,9 +718,9 @@ impl Worker {
716718
}
717719

718720
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());
720722
let dec_key = acc
721-
.extract_key(&self.dkg_sk, None)
723+
.extract_key(&self.dkg_sk, prev)
722724
.map_err(|e| DecrypterError::Dkg(e.to_string()))?;
723725
self.tracker.insert(committee.id(), acc);
724726

0 commit comments

Comments
 (0)