diff options
author | Péter Szilágyi <peterke@gmail.com> | 2016-05-17 19:17:20 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-05-17 19:17:20 +0800 |
commit | d87f7a1e817cbecbb62c012ed3811ceba933ae3a (patch) | |
tree | 438a14920171c8fbbff7995c15bf09a80993a50b /eth/sync.go | |
parent | adc1b503957e572c4ec30533de3ec28ec6feea13 (diff) | |
download | go-tangerine-d87f7a1e817cbecbb62c012ed3811ceba933ae3a.tar.gz go-tangerine-d87f7a1e817cbecbb62c012ed3811ceba933ae3a.tar.zst go-tangerine-d87f7a1e817cbecbb62c012ed3811ceba933ae3a.zip |
eth: skip transaction handling during fast sync
Diffstat (limited to 'eth/sync.go')
-rw-r--r-- | eth/sync.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/eth/sync.go b/eth/sync.go index 69881530d..4b16c1322 100644 --- a/eth/sync.go +++ b/eth/sync.go @@ -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) } } } |