mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
eth: if our chain is better, propagate it back to peers
This commit is contained in:
parent
0d71b2fc98
commit
9a05d3e761
1 changed files with 5 additions and 1 deletions
|
|
@ -171,7 +171,11 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
|
||||||
td := pm.blockchain.GetTd(currentBlock.Hash(), currentBlock.NumberU64())
|
td := pm.blockchain.GetTd(currentBlock.Hash(), currentBlock.NumberU64())
|
||||||
|
|
||||||
pHead, pTd := peer.Head()
|
pHead, pTd := peer.Head()
|
||||||
if pTd.Cmp(td) <= 0 {
|
if cmp := pTd.Cmp(td); cmp <= 0 {
|
||||||
|
if cmp < 0 {
|
||||||
|
// propagate our better chain back to peers
|
||||||
|
go pm.BroadcastBlock(currentBlock, true)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Otherwise try to sync with the downloader
|
// Otherwise try to sync with the downloader
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue