Skip to content

Commit bd2c54f

Browse files
committed
eth: announce block after sync cycle (star topology)
1 parent 8570ef1 commit bd2c54f

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎eth/sync.go‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,15 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
189189
return
190190
}
191191
atomic.StoreUint32(&pm.synced, 1) // Mark initial sync done
192-
192+
if head := pm.blockchain.CurrentBlock(); head.NumberU64() > 0 {
193+
// We've completed a sync cycle, notify all peers of new state. This path is
194+
// essential in star-topology networks where a gateway node needs to notify
195+
// all its out-of-date peers of the availability of a new block. This failure
196+
// scenario will most often crop up in private and hackathon networks with
197+
// degenerate connectivity, but it should be healthy for the mainnet too to
198+
// more reliably update peers or the local TD state.
199+
go pm.BroadcastBlock(head, false)
200+
}
193201
// If fast sync was enabled, and we synced up, disable it
194202
if atomic.LoadUint32(&pm.fastSync) == 1 {
195203
// Disable fast sync if we indeed have something in our chain

0 commit comments

Comments
 (0)