mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-05 15:52:55 +00:00
Merge pull request #13883 from karalabe/boardcast-sync-head
eth: announce block after sync cycle (star topology)
This commit is contained in:
commit
f32b72ca5d
1 changed files with 9 additions and 1 deletions
10
eth/sync.go
10
eth/sync.go
|
|
@ -189,7 +189,15 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
atomic.StoreUint32(&pm.synced, 1) // Mark initial sync done
|
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 fast sync was enabled, and we synced up, disable it
|
||||||
if atomic.LoadUint32(&pm.fastSync) == 1 {
|
if atomic.LoadUint32(&pm.fastSync) == 1 {
|
||||||
// Disable fast sync if we indeed have something in our chain
|
// Disable fast sync if we indeed have something in our chain
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue