Skip to content

Commit

Permalink
fix: fraud peer ban doesn't work in some cases (#2867)
Browse files Browse the repository at this point in the history
  • Loading branch information
garyyu authored May 31, 2019
1 parent 56b62a3 commit e345405
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions servers/src/grin/sync/header_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,10 @@ impl HeaderSync {
if let Some(ref stalling_ts) = self.stalling_ts {
if let Some(ref peer) = self.syncing_peer {
match self.sync_state.status() {
SyncStatus::HeaderSync {
current_height: _,
highest_height,
} => {
SyncStatus::HeaderSync { .. } | SyncStatus::BodySync { .. } => {
// Ban this fraud peer which claims a higher work but can't send us the real headers
if now > *stalling_ts + Duration::seconds(120)
&& highest_height == peer.info.height()
&& header_head.total_difficulty < peer.info.total_difficulty()
{
self.peers
.ban_peer(peer.info.addr, ReasonForBan::FraudHeight);
Expand Down

0 comments on commit e345405

Please sign in to comment.