aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-06-05 23:28:08 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-06-05 23:28:08 +0800
commit8c281269840ddec5a5439877313e00327069c970 (patch)
treeebe876afe8359e9014188721c876216cce94bd14
parent067e66b34869402cf7bd0f352dad37bd4200e976 (diff)
parent94e525ae12bf3455ae434feb83ad834c8dcfa1ad (diff)
downloaddexon-8c281269840ddec5a5439877313e00327069c970.tar
dexon-8c281269840ddec5a5439877313e00327069c970.tar.gz
dexon-8c281269840ddec5a5439877313e00327069c970.tar.bz2
dexon-8c281269840ddec5a5439877313e00327069c970.tar.lz
dexon-8c281269840ddec5a5439877313e00327069c970.tar.xz
dexon-8c281269840ddec5a5439877313e00327069c970.tar.zst
dexon-8c281269840ddec5a5439877313e00327069c970.zip
Merge pull request #1100 from karalabe/drop-sync-peer-on-empty-hash
eth, eth/downloader: fix #1098, elevate empty hash errors to peer drops
-rw-r--r--eth/downloader/downloader.go4
-rw-r--r--eth/sync.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go
index d8dbef726..6f1c94a91 100644
--- a/eth/downloader/downloader.go
+++ b/eth/downloader/downloader.go
@@ -42,7 +42,7 @@ var (
errNoPeers = errors.New("no peers to keep download active")
ErrPendingQueue = errors.New("pending items in queue")
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")
errAlreadyInPool = errors.New("hash already in pool")
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
if len(hashPack.hashes) == 0 {
glog.V(logger.Debug).Infof("Peer (%s) responded with empty hash set", active.id)
- return errEmptyHashSet
+ return ErrEmptyHashSet
}
for _, hash := range hashPack.hashes {
if d.banned.Has(hash) {
diff --git a/eth/sync.go b/eth/sync.go
index 76e137630..56084f2f0 100644
--- a/eth/sync.go
+++ b/eth/sync.go
@@ -109,7 +109,7 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
case downloader.ErrBusy:
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)
pm.removePeer(peer.id)