diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-02-12 01:01:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-12 01:01:32 +0800 |
commit | 62ffec1be371a00749086b52c8e6743b9a3f2bae (patch) | |
tree | 3a92d8f9daf4812320014f5e9df34f52c619f3e0 | |
parent | aa9432b8168734aed4e8180eb59f456b0ae2a74c (diff) | |
parent | 57fd2da0fe2ec4d48db7fa936d9e5b6ddb547bf9 (diff) | |
download | dexon-62ffec1be371a00749086b52c8e6743b9a3f2bae.tar dexon-62ffec1be371a00749086b52c8e6743b9a3f2bae.tar.gz dexon-62ffec1be371a00749086b52c8e6743b9a3f2bae.tar.bz2 dexon-62ffec1be371a00749086b52c8e6743b9a3f2bae.tar.lz dexon-62ffec1be371a00749086b52c8e6743b9a3f2bae.tar.xz dexon-62ffec1be371a00749086b52c8e6743b9a3f2bae.tar.zst dexon-62ffec1be371a00749086b52c8e6743b9a3f2bae.zip |
Merge pull request #16062 from karalabe/nodisable-fastsync
eth: only disable fast sync after success
-rw-r--r-- | eth/sync.go | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/eth/sync.go b/eth/sync.go index a8ae64617..2da1464bc 100644 --- a/eth/sync.go +++ b/eth/sync.go @@ -189,18 +189,13 @@ func (pm *ProtocolManager) synchronise(peer *peer) { mode = downloader.FastSync } // Run the sync cycle, and disable fast sync if we've went past the pivot block - err := pm.downloader.Synchronise(peer.id, pHead, pTd, mode) - - if atomic.LoadUint32(&pm.fastSync) == 1 { - // Disable fast sync if we indeed have something in our chain - if pm.blockchain.CurrentBlock().NumberU64() > 0 { - log.Info("Fast sync complete, auto disabling") - atomic.StoreUint32(&pm.fastSync, 0) - } - } - if err != nil { + if err := pm.downloader.Synchronise(peer.id, pHead, pTd, mode); err != nil { return } + if atomic.LoadUint32(&pm.fastSync) == 1 { + log.Info("Fast sync complete, auto disabling") + atomic.StoreUint32(&pm.fastSync, 0) + } atomic.StoreUint32(&pm.acceptTxs, 1) // Mark initial sync done if head := pm.blockchain.CurrentBlock(); head.NumberU64() > 0 { // We've completed a sync cycle, notify all peers of new state. This path is |