mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
fix: fraud peer ban doesn't work in some cases (#2867)
This commit is contained in:
parent
56b62a319b
commit
e345405201
1 changed files with 2 additions and 5 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue