From 492d5454b1e1e1ce18999827a5fd98562bfdbe0e Mon Sep 17 00:00:00 2001 From: Péter Szilágyi Date: Thu, 9 Jul 2015 14:40:18 +0300 Subject: eth/downloader: drop peer if advertised TD but won't delvier --- eth/downloader/downloader.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'eth/downloader/downloader.go') diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 5ce98816d..7cf83ada3 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -804,6 +804,8 @@ func (d *Downloader) fetchHashes(p *peer, from uint64) error { } // Start pulling hashes, until all are exhausted getHashes(from) + gotHashes := false + for { select { case <-d.cancelCh: @@ -825,8 +827,14 @@ func (d *Downloader) fetchHashes(p *peer, from uint64) error { case d.processCh <- false: case <-d.cancelCh: } + // Error out if no hashes were retrieved at all + if !gotHashes { + return errStallingPeer + } return nil } + gotHashes = true + // Otherwise insert all the new hashes, aborting in case of junk glog.V(logger.Detail).Infof("%v: inserting %d hashes from #%d", p, len(hashPack.hashes), from) -- cgit