Skip to content

Commit

Permalink
fix: remove peer (#5757)
Browse files Browse the repository at this point in the history
Description
---
Fixes remove peer in header sync
Fixes latency counter in block sync

Motivation and Context
---
Header sync should remove the peer for all errors
Block sync should only increase the latency once
  • Loading branch information
SWvheerden authored Sep 12, 2023
1 parent 65c178b commit 4c48a26
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
4 changes: 0 additions & 4 deletions base_layer/core/src/base_node/sync/block_sync/synchronizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,6 @@ impl<'a, B: BlockchainBackend + 'static> BlockSynchronizer<'a, B> {
} else {
self.remove_sync_peer(node_id);
}

if let BlockSyncError::MaxLatencyExceeded { .. } = err {
latency_counter += 1;
}
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,11 @@ impl<'a, B: BlockchainBackend + 'static> HeaderSynchronizer<'a, B> {
self.peer_ban_manager
.ban_peer_if_required(node_id, &Some(reason.clone()))
.await;

if reason.ban_duration > self.config.short_ban_period {
self.remove_sync_peer(node_id);
}
}

if let BlockHeaderSyncError::MaxLatencyExceeded { .. } = err {
latency_counter += 1;
} else {
self.remove_sync_peer(node_id);
}
},
}
Expand Down

0 comments on commit 4c48a26

Please sign in to comment.