fix tally_by condition (#234)

This commit is contained in:
Al Liu 2023-06-28 17:56:16 +08:00 committed by GitHub
parent 4a80690c1f
commit 224a3a53f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -425,15 +425,15 @@ impl<L: UpdateableLeaderSelection, O: Overlay<LeaderSelection = L>> Node for Car
timeout_qc,
new_views,
} => {
let (new, out) = self.engine.approve_new_view(timeout_qc.clone(), new_views);
output.push(Output::Send(out));
self.engine = new;
tracing::info!(
node = parse_idx(&self.id),
current_view = self.engine.current_view(),
timeout_view = timeout_qc.view,
"receive new view message"
);
let (new, out) = self.engine.approve_new_view(timeout_qc.clone(), new_views);
output.push(Output::Send(out));
self.engine = new;
}
Event::TimeoutQc { timeout_qc } => {
tracing::info!(

View File

@ -28,7 +28,7 @@ impl<T: core::hash::Hash + Eq> Tally<T> {
let entries = self.cache.entry(view).or_default();
entries.insert(message);
let entries = entries.len();
if entries >= threshold {
if entries == threshold {
Some(self.cache.remove(&view).unwrap())
} else {
None