diff options
author | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-05-17 20:56:57 +0800 |
---|---|---|
committer | Jeffrey Wilcke <jeffrey@ethereum.org> | 2016-05-17 20:56:57 +0800 |
commit | c8a8ad97f7e8889ca9f3aece7ddb50cce8ef18c7 (patch) | |
tree | 438a14920171c8fbbff7995c15bf09a80993a50b /eth/sync.go | |
parent | adc1b503957e572c4ec30533de3ec28ec6feea13 (diff) | |
parent | d87f7a1e817cbecbb62c012ed3811ceba933ae3a (diff) | |
download | go-tangerine-c8a8ad97f7e8889ca9f3aece7ddb50cce8ef18c7.tar go-tangerine-c8a8ad97f7e8889ca9f3aece7ddb50cce8ef18c7.tar.gz go-tangerine-c8a8ad97f7e8889ca9f3aece7ddb50cce8ef18c7.tar.bz2 go-tangerine-c8a8ad97f7e8889ca9f3aece7ddb50cce8ef18c7.tar.lz go-tangerine-c8a8ad97f7e8889ca9f3aece7ddb50cce8ef18c7.tar.xz go-tangerine-c8a8ad97f7e8889ca9f3aece7ddb50cce8ef18c7.tar.zst go-tangerine-c8a8ad97f7e8889ca9f3aece7ddb50cce8ef18c7.zip |
Merge pull request #2574 from karalabe/notx-during-fastsync
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) } } } |