diff options
author | Péter Szilágyi <peterke@gmail.com> | 2015-05-14 20:38:49 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2015-05-14 20:38:49 +0800 |
commit | 3eda70c64c3b790573751227f8ac0fe42bdc0307 (patch) | |
tree | a5f402ea615e2484bf405f845b77ecd229a5842f /eth/sync.go | |
parent | a4246c2da658d9b5b02a4caba511688748a88b19 (diff) | |
download | go-tangerine-3eda70c64c3b790573751227f8ac0fe42bdc0307.tar.gz go-tangerine-3eda70c64c3b790573751227f8ac0fe42bdc0307.tar.zst go-tangerine-3eda70c64c3b790573751227f8ac0fe42bdc0307.zip |
eth, eth/downloader: remove parent verification from the downlaoder
Diffstat (limited to 'eth/sync.go')
-rw-r--r-- | eth/sync.go | 13 |
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:] |