mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-06 22:26:47 +00:00
[NOD-1030] Disconnect from syncPeers that send orphan blocks (#744)
* [NOD-1030] Disconnect from syncPeers that send orphan blocks. * [NOD-1030] Remove debug log. * [NOD-1030] Remove unnecessary call to stopSyncFromPeer.
This commit is contained in:
parent
6219b93430
commit
d15c009b3c
@ -529,8 +529,17 @@ func (sm *SyncManager) handleBlockMsg(bmsg *blockMsg) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request the parents for the orphan block from the peer that sent it.
|
|
||||||
if isOrphan {
|
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)
|
missingAncestors, err := sm.dag.GetOrphanMissingAncestorHashes(blockHash)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("Failed to find missing ancestors for block %s: %s",
|
log.Errorf("Failed to find missing ancestors for block %s: %s",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user