Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Make RollingFinality::remove_signers more tolerant.
Browse files Browse the repository at this point in the history
  • Loading branch information
afck committed Aug 13, 2019
1 parent 2c17763 commit 96b01a2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ethcore/src/engines/authority_round/finality.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,14 @@ impl RollingFinality {
match self.sign_count.entry(*signer) {
Entry::Occupied(mut entry) => {
// decrement count for this signer and purge on zero.
*entry.get_mut() -= 1;

if *entry.get() == 0 {
if *entry.get() <= 1 {
entry.remove();
} else {
*entry.get_mut() -= 1;
}
}
Entry::Vacant(_) => {
panic!("all hashes in `header` should have entries in `sign_count` for their signers; qed");
error!(target: "engine", "Called `remove_signers` with a vacant entry. This is a bug!");
}
}
}
Expand Down

0 comments on commit 96b01a2

Please sign in to comment.