diff --git a/netsync/manager.go b/netsync/manager.go index fc43d7fbe..31923cc62 100644 --- a/netsync/manager.go +++ b/netsync/manager.go @@ -529,8 +529,17 @@ func (sm *SyncManager) handleBlockMsg(bmsg *blockMsg) { return } - // Request the parents for the orphan block from the peer that sent it. if isOrphan { + // If we received an orphan block from the sync peer, it is + // misbehaving and must be disconnected from. + if peer == sm.syncPeer { + log.Errorf("Received an orphan block %s from sync peer %s. Disconnecting...", + blockHash, peer) + peer.Disconnect() + return + } + + // Request the parents for the orphan block from the peer that sent it. missingAncestors, err := sm.dag.GetOrphanMissingAncestorHashes(blockHash) if err != nil { log.Errorf("Failed to find missing ancestors for block %s: %s",