Skip to content

Commit

Permalink
Merge pull request ethereum#16062 from karalabe/nodisable-fastsync
Browse files Browse the repository at this point in the history
eth: only disable fast sync after success
  • Loading branch information
karalabe authored Feb 11, 2018
2 parents aa9432b + 57fd2da commit 62ffec1
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions eth/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 62ffec1

Please sign in to comment.