aboutsummaryrefslogtreecommitdiffstats
path: root/eth/downloader/downloader.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-05-14 23:16:30 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-05-14 23:16:30 +0800
commit060a07cf69a2083611565e92cfa78d35c71cdb9f (patch)
tree4d499550d07ebf21d74f08dc7667213faf7621de /eth/downloader/downloader.go
parent90b94e64fcdc6a2099ec5c48e41acf7f95a6b804 (diff)
parentfe87feccb157b2426075523a592cabcb4c6d1cf0 (diff)
downloaddexon-060a07cf69a2083611565e92cfa78d35c71cdb9f.tar
dexon-060a07cf69a2083611565e92cfa78d35c71cdb9f.tar.gz
dexon-060a07cf69a2083611565e92cfa78d35c71cdb9f.tar.bz2
dexon-060a07cf69a2083611565e92cfa78d35c71cdb9f.tar.lz
dexon-060a07cf69a2083611565e92cfa78d35c71cdb9f.tar.xz
dexon-060a07cf69a2083611565e92cfa78d35c71cdb9f.tar.zst
dexon-060a07cf69a2083611565e92cfa78d35c71cdb9f.zip
Merge pull request #974 from karalabe/downloader-fix-unknown-parent-attack
eth, eth/downloader: handle a potential unknown parent attack
Diffstat (limited to 'eth/downloader/downloader.go')
-rw-r--r--eth/downloader/downloader.go11
1 files changed, 2 insertions, 9 deletions
diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go
index 85de78ebf..cc75c3014 100644
--- a/eth/downloader/downloader.go
+++ b/eth/downloader/downloader.go
@@ -150,16 +150,9 @@ func (d *Downloader) Synchronise(id string, hash common.Hash) error {
return d.syncWithPeer(p, hash)
}
-// TakeBlocks takes blocks from the queue and yields them to the blockTaker handler
-// it's possible it yields no blocks
+// TakeBlocks takes blocks from the queue and yields them to the caller.
func (d *Downloader) TakeBlocks() types.Blocks {
- // Check that there are blocks available and its parents are known
- head := d.queue.GetHeadBlock()
- if head == nil || !d.hasBlock(head.ParentHash()) {
- return nil
- }
- // Retrieve a full batch of blocks
- return d.queue.TakeBlocks(head)
+ return d.queue.TakeBlocks()
}
func (d *Downloader) Has(hash common.Hash) bool {