From aba6f6a4e4d96af70c0276e620cf88c173963a09 Mon Sep 17 00:00:00 2001 From: Byeongjee Kang Date: Tue, 18 Feb 2020 10:49:04 +0900 Subject: [PATCH 1/2] Rename double vote variable Some DoubleVote type variables should be renamed for consistency. --- core/src/consensus/tendermint/worker.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/src/consensus/tendermint/worker.rs b/core/src/consensus/tendermint/worker.rs index 5f3aa0ead7..854d5db4c4 100644 --- a/core/src/consensus/tendermint/worker.rs +++ b/core/src/consensus/tendermint/worker.rs @@ -1430,9 +1430,9 @@ impl Worker { self.votes_received.set(vote_index); } - if let Err(double) = self.votes.collect(message.clone()) { - cerror!(ENGINE, "Double vote found {:?}", double); - self.report_double_vote(&double); + if let Err(double_vote) = self.votes.collect(message.clone()) { + cerror!(ENGINE, "Double vote found {:?}", double_vote); + self.report_double_vote(&double_vote); return Err(EngineError::DoubleVote(sender)) } ctrace!(ENGINE, "Handling a valid {:?} from {}.", message, sender); @@ -1823,9 +1823,9 @@ impl Worker { ); } - if let Err(double) = self.votes.collect(message) { - cerror!(ENGINE, "Double Vote found {:?}", double); - self.report_double_vote(&double); + if let Err(double_vote) = self.votes.collect(message) { + cerror!(ENGINE, "Double Vote found {:?}", double_vote); + self.report_double_vote(&double_vote); return None } } From 51c5d789447d97390f24b2c486d8214db62af96b Mon Sep 17 00:00:00 2001 From: Byeongjee Kang Date: Tue, 18 Feb 2020 10:55:03 +0900 Subject: [PATCH 2/2] Report double votes found in commit messages --- core/src/consensus/tendermint/worker.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/src/consensus/tendermint/worker.rs b/core/src/consensus/tendermint/worker.rs index 854d5db4c4..81e8644a18 100644 --- a/core/src/consensus/tendermint/worker.rs +++ b/core/src/consensus/tendermint/worker.rs @@ -954,6 +954,7 @@ impl Worker { if !self.votes.is_old_or_known(&message) { if let Err(double_vote) = self.votes.collect(message) { cerror!(ENGINE, "Double vote found on_commit_message: {:?}", double_vote); + self.report_double_vote(&double_vote); } } } @@ -2163,6 +2164,7 @@ impl Worker { if !self.votes.is_old_or_known(&vote) { if let Err(double_vote) = self.votes.collect(vote) { cerror!(ENGINE, "Double vote found on_commit_message: {:?}", double_vote); + self.report_double_vote(&double_vote); } } }