aboutsummaryrefslogtreecommitdiffstats
path: root/eth/sync.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-10-28 22:41:01 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-10-28 22:41:01 +0800
commit2019ed71b4758956a8bd9671c73ba98a244f4a7b (patch)
tree569c1bd3051eab38d5a82415c331d0ca7d5ad952 /eth/sync.go
parent6b5a42a15ca54749d41c0b29b4a26ebb3a1a53f0 (diff)
downloadgo-tangerine-2019ed71b4758956a8bd9671c73ba98a244f4a7b.tar
go-tangerine-2019ed71b4758956a8bd9671c73ba98a244f4a7b.tar.gz
go-tangerine-2019ed71b4758956a8bd9671c73ba98a244f4a7b.tar.bz2
go-tangerine-2019ed71b4758956a8bd9671c73ba98a244f4a7b.tar.lz
go-tangerine-2019ed71b4758956a8bd9671c73ba98a244f4a7b.tar.xz
go-tangerine-2019ed71b4758956a8bd9671c73ba98a244f4a7b.tar.zst
go-tangerine-2019ed71b4758956a8bd9671c73ba98a244f4a7b.zip
eth: don't block sync goroutines that short circuit
Diffstat (limited to 'eth/sync.go')
-rw-r--r--eth/sync.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/eth/sync.go b/eth/sync.go
index b69a24556..bbf2abc04 100644
--- a/eth/sync.go
+++ b/eth/sync.go
@@ -170,13 +170,16 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
if pm.fastSync {
mode = downloader.FastSync
}
- pm.downloader.Synchronise(peer.id, peer.Head(), peer.Td(), mode)
-
+ 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 {
+ // Wait until all pending imports finish processing
for pm.downloader.Synchronising() {
time.Sleep(100 * time.Millisecond)
}
+ // 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