[release/1.4.4] eth: skip transaction handling during fast sync

(cherry picked from commit d87f7a1e81)
This commit is contained in:
Péter Szilágyi
2016-05-17 14:17:20 +03:00
committed by Jeffrey Wilcke
parent 4b11f207cb
commit 4c6953606e
3 changed files with 23 additions and 14 deletions

View File

@@ -18,6 +18,7 @@ package eth
import (
"math/rand"
"sync/atomic"
"time"
"github.com/ethereum/go-ethereum/common"
@@ -167,18 +168,18 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
}
// Otherwise try to sync with the downloader
mode := downloader.FullSync
if pm.fastSync {
if atomic.LoadUint32(&pm.fastSync) == 1 {
mode = downloader.FastSync
}
if err := pm.downloader.Synchronise(peer.id, peer.Head(), peer.Td(), mode); err != nil {
return
}
// If fast sync was enabled, and we synced up, disable it
if pm.fastSync {
if atomic.LoadUint32(&pm.fastSync) == 1 {
// Disable fast sync if we indeed have something in our chain
if pm.blockchain.CurrentBlock().NumberU64() > 0 {
glog.V(logger.Info).Infof("fast sync complete, auto disabling")
pm.fastSync = false
atomic.StoreUint32(&pm.fastSync, 0)
}
}
}