From 186efbc2a5cc77af60708e65bf03f172ceec708d Mon Sep 17 00:00:00 2001
From: Seun Lanlege <seunlanlege@gmail.com>
Date: Wed, 17 Nov 2021 13:46:10 +0100
Subject: [PATCH] Check if BEEFY authority is in current set (#10281)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* check if BEEFY authority is in current set

* Update client/beefy/src/round.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update client/beefy/src/round.rs

* Update client/beefy/src/round.rs

Co-authored-by: Andreas Doerr <adoerr@users.noreply.github.com>

* remove stray semi

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Andreas Doerr <adoerr@users.noreply.github.com>
---
 substrate/client/beefy/src/round.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/substrate/client/beefy/src/round.rs b/substrate/client/beefy/src/round.rs
index 7d443603b36..51284c9bd2f 100644
--- a/substrate/client/beefy/src/round.rs
+++ b/substrate/client/beefy/src/round.rs
@@ -82,7 +82,11 @@ where
 	}
 
 	pub(crate) fn add_vote(&mut self, round: (H, N), vote: (Public, Signature)) -> bool {
-		self.rounds.entry(round).or_default().add_vote(vote)
+		if self.validator_set.validators.iter().any(|id| vote.0 == *id) {
+			self.rounds.entry(round).or_default().add_vote(vote)
+		} else {
+			false
+		}
 	}
 
 	pub(crate) fn is_done(&self, round: &(H, N)) -> bool {
-- 
GitLab