Commit 492d5454 authored by Péter Szilágyi's avatar Péter Szilágyi

eth/downloader: drop peer if advertised TD but won't delvier

parent a2333bcb
...@@ -804,6 +804,8 @@ func (d *Downloader) fetchHashes(p *peer, from uint64) error { ...@@ -804,6 +804,8 @@ func (d *Downloader) fetchHashes(p *peer, from uint64) error {
} }
// Start pulling hashes, until all are exhausted // Start pulling hashes, until all are exhausted
getHashes(from) getHashes(from)
gotHashes := false
for { for {
select { select {
case <-d.cancelCh: case <-d.cancelCh:
...@@ -825,8 +827,14 @@ func (d *Downloader) fetchHashes(p *peer, from uint64) error { ...@@ -825,8 +827,14 @@ func (d *Downloader) fetchHashes(p *peer, from uint64) error {
case d.processCh <- false: case d.processCh <- false:
case <-d.cancelCh: case <-d.cancelCh:
} }
// Error out if no hashes were retrieved at all
if !gotHashes {
return errStallingPeer
}
return nil return nil
} }
gotHashes = true
// Otherwise insert all the new hashes, aborting in case of junk // 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) glog.V(logger.Detail).Infof("%v: inserting %d hashes from #%d", p, len(hashPack.hashes), from)
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment