mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-26 05:27:19 +00:00
Merge pull request #1100 from karalabe/drop-sync-peer-on-empty-hash
eth, eth/downloader: fix #1098, elevate empty hash errors to peer drops
This commit is contained in:
commit
8c28126984
@ -42,7 +42,7 @@ var (
|
|||||||
errNoPeers = errors.New("no peers to keep download active")
|
errNoPeers = errors.New("no peers to keep download active")
|
||||||
ErrPendingQueue = errors.New("pending items in queue")
|
ErrPendingQueue = errors.New("pending items in queue")
|
||||||
ErrTimeout = errors.New("timeout")
|
ErrTimeout = errors.New("timeout")
|
||||||
errEmptyHashSet = errors.New("empty hash set by peer")
|
ErrEmptyHashSet = errors.New("empty hash set by peer")
|
||||||
errPeersUnavailable = errors.New("no peers available or all peers tried for block download process")
|
errPeersUnavailable = errors.New("no peers available or all peers tried for block download process")
|
||||||
errAlreadyInPool = errors.New("hash already in pool")
|
errAlreadyInPool = errors.New("hash already in pool")
|
||||||
ErrInvalidChain = errors.New("retrieved hash chain is invalid")
|
ErrInvalidChain = errors.New("retrieved hash chain is invalid")
|
||||||
@ -289,7 +289,7 @@ func (d *Downloader) fetchHashes(p *peer, h common.Hash) error {
|
|||||||
// Make sure the peer actually gave something valid
|
// Make sure the peer actually gave something valid
|
||||||
if len(hashPack.hashes) == 0 {
|
if len(hashPack.hashes) == 0 {
|
||||||
glog.V(logger.Debug).Infof("Peer (%s) responded with empty hash set", active.id)
|
glog.V(logger.Debug).Infof("Peer (%s) responded with empty hash set", active.id)
|
||||||
return errEmptyHashSet
|
return ErrEmptyHashSet
|
||||||
}
|
}
|
||||||
for _, hash := range hashPack.hashes {
|
for _, hash := range hashPack.hashes {
|
||||||
if d.banned.Has(hash) {
|
if d.banned.Has(hash) {
|
||||||
|
@ -109,7 +109,7 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
|
|||||||
case downloader.ErrBusy:
|
case downloader.ErrBusy:
|
||||||
glog.V(logger.Debug).Infof("Synchronisation already in progress")
|
glog.V(logger.Debug).Infof("Synchronisation already in progress")
|
||||||
|
|
||||||
case downloader.ErrTimeout, downloader.ErrBadPeer, downloader.ErrInvalidChain, downloader.ErrCrossCheckFailed:
|
case downloader.ErrTimeout, downloader.ErrBadPeer, downloader.ErrEmptyHashSet, downloader.ErrInvalidChain, downloader.ErrCrossCheckFailed:
|
||||||
glog.V(logger.Debug).Infof("Removing peer %v: %v", peer.id, err)
|
glog.V(logger.Debug).Infof("Removing peer %v: %v", peer.id, err)
|
||||||
pm.removePeer(peer.id)
|
pm.removePeer(peer.id)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user