aboutsummaryrefslogtreecommitdiffstats
path: root/eth/sync.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-05-14 20:38:49 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-05-14 20:38:49 +0800
commit3eda70c64c3b790573751227f8ac0fe42bdc0307 (patch)
treea5f402ea615e2484bf405f845b77ecd229a5842f /eth/sync.go
parenta4246c2da658d9b5b02a4caba511688748a88b19 (diff)
downloaddexon-3eda70c64c3b790573751227f8ac0fe42bdc0307.tar.gz
dexon-3eda70c64c3b790573751227f8ac0fe42bdc0307.tar.zst
dexon-3eda70c64c3b790573751227f8ac0fe42bdc0307.zip
eth, eth/downloader: remove parent verification from the downlaoder
Diffstat (limited to 'eth/sync.go')
-rw-r--r--eth/sync.go13
1 files changed, 4 insertions, 9 deletions
diff --git a/eth/sync.go b/eth/sync.go
index b51fb7c10..c89f34596 100644
--- a/eth/sync.go
+++ b/eth/sync.go
@@ -40,9 +40,7 @@ func (pm *ProtocolManager) update() {
// Try to pull some blocks from the downloaded
if atomic.CompareAndSwapInt32(&blockProcPend, 0, 1) {
go func() {
- if err := pm.processBlocks(); err != nil {
- pm.downloader.Cancel()
- }
+ pm.processBlocks()
atomic.StoreInt32(&blockProcPend, 0)
}()
}
@@ -61,12 +59,8 @@ func (pm *ProtocolManager) processBlocks() error {
pm.wg.Add(1)
defer pm.wg.Done()
- // Take a batch of blocks, but abort if there's an invalid head or if the chain's empty
- blocks, err := pm.downloader.TakeBlocks()
- if err != nil {
- glog.V(logger.Warn).Infof("Block processing failed: %v", err)
- return err
- }
+ // Short circuit if no blocks are available for insertion
+ blocks := pm.downloader.TakeBlocks()
if len(blocks) == 0 {
return nil
}
@@ -77,6 +71,7 @@ func (pm *ProtocolManager) processBlocks() error {
_, err := pm.chainman.InsertChain(blocks[:max])
if err != nil {
glog.V(logger.Warn).Infof("Block insertion failed: %v", err)
+ pm.downloader.Cancel()
return err
}
blocks = blocks[max:]