Default block announce validation should reject additional data (#7726)

If we are using the default block announce validator and receive
additional data alongside the block announcement, we should disconnect
this peer.
This commit is contained in:
Bastian Köcher
2020-12-14 18:47:08 +01:00
committed by GitHub
parent 6b08b37bc9
commit 059746183d
3 changed files with 33 additions and 8 deletions
+5 -1
View File
@@ -1148,7 +1148,11 @@ impl<B: BlockT, H: ExHashT> Protocol<B, H> {
self.update_peer_info(&who);
(header, is_best, who)
}
sync::PollBlockAnnounceValidation::Failure { who } => {
sync::PollBlockAnnounceValidation::Failure { who, disconnect } => {
if disconnect {
self.disconnect_peer(&who);
}
self.report_peer(who, rep::BAD_BLOCK_ANNOUNCEMENT);
return CustomMessageOutcome::None
}