aboutsummaryrefslogtreecommitdiffstats
path: root/eth/sync.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-04-10 14:03:00 +0800
committerGitHub <noreply@github.com>2017-04-10 14:03:00 +0800
commitf32b72ca5d7c477e5f5d3ab0d5b6548bf3fdc139 (patch)
tree2bd38374b0388123ad0e7d245ef83ae41d10f921 /eth/sync.go
parent9cd713551627a9b48e04a77f64a15ea6f829dcf4 (diff)
parentbd2c54fa9f16d57d6158496351da43e3caf66c87 (diff)
downloadgo-tangerine-f32b72ca5d7c477e5f5d3ab0d5b6548bf3fdc139.tar
go-tangerine-f32b72ca5d7c477e5f5d3ab0d5b6548bf3fdc139.tar.gz
go-tangerine-f32b72ca5d7c477e5f5d3ab0d5b6548bf3fdc139.tar.bz2
go-tangerine-f32b72ca5d7c477e5f5d3ab0d5b6548bf3fdc139.tar.lz
go-tangerine-f32b72ca5d7c477e5f5d3ab0d5b6548bf3fdc139.tar.xz
go-tangerine-f32b72ca5d7c477e5f5d3ab0d5b6548bf3fdc139.tar.zst
go-tangerine-f32b72ca5d7c477e5f5d3ab0d5b6548bf3fdc139.zip
Merge pull request #13883 from karalabe/boardcast-sync-head
eth: announce block after sync cycle (star topology)
Diffstat (limited to 'eth/sync.go')
-rw-r--r--eth/sync.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/eth/sync.go b/eth/sync.go
index f2cae6c19..68d3afdb8 100644
--- a/eth/sync.go
+++ b/eth/sync.go
@@ -189,7 +189,15 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
return
}
atomic.StoreUint32(&pm.synced, 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
+ // essential in star-topology networks where a gateway node needs to notify
+ // all its out-of-date peers of the availability of a new block. This failure
+ // scenario will most often crop up in private and hackathon networks with
+ // degenerate connectivity, but it should be healthy for the mainnet too to
+ // more reliably update peers or the local TD state.
+ go pm.BroadcastBlock(head, false)
+ }
// If fast sync was enabled, and we synced up, disable it
if atomic.LoadUint32(&pm.fastSync) == 1 {
// Disable fast sync if we indeed have something in our chain