Skip to content
Snippets Groups Projects
Commit ba50664f authored by Arkadiy Paronyan's avatar Arkadiy Paronyan Committed by GitHub
Browse files

Reputation penalty for sending empty block response (#5814)

parent 6b35ac6f
Branches
No related merge requests found
......@@ -90,6 +90,9 @@ mod rep {
/// Reputation change for peers which send us a known bad block.
pub const BAD_BLOCK: Rep = Rep::new(-(1 << 29), "Bad block");
/// Peer did not provide us with advertised block data.
pub const NO_BLOCK: Rep = Rep::new(-(1 << 29), "No requested block data");
/// Reputation change for peers which send us a known block.
pub const KNOWN_BLOCK: Rep = Rep::new(-(1 << 29), "Duplicate block");
......@@ -696,6 +699,10 @@ impl<B: BlockT> ChainSync<B> {
}
PeerSyncState::DownloadingStale(_) => {
peer.state = PeerSyncState::Available;
if blocks.is_empty() {
debug!(target: "sync", "Empty block response from {}", who);
return Err(BadPeer(who, rep::NO_BLOCK));
}
blocks.into_iter().map(|b| {
IncomingBlock {
hash: b.hash,
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment