From bd2c54fa9f16d57d6158496351da43e3caf66c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Sun, 9 Apr 2017 20:12:46 +0300 Subject: eth: announce block after sync cycle (star topology) --- eth/sync.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3