good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit dc6e98d2 authored by Péter Szilágyi's avatar Péter Szilágyi
Browse files

eth: when triggering a sync, check the head header TD, not block

parent 5dd0cd12
No related branches found
No related tags found
No related merge requests found
......@@ -727,8 +727,8 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
// Schedule a sync if above ours. Note, this will not fire a sync for a gap of
// a single block (as the true TD is below the propagated block), however this
// scenario should easily be covered by the fetcher.
currentBlock := pm.blockchain.CurrentBlock()
if trueTD.Cmp(pm.blockchain.GetTd(currentBlock.Hash(), currentBlock.NumberU64())) > 0 {
currentHeader := pm.blockchain.CurrentHeader()
if trueTD.Cmp(pm.blockchain.GetTd(currentHeader.Hash(), currentHeader.Number.Uint64())) > 0 {
go pm.synchronise(p)
}
}
......
......@@ -189,8 +189,8 @@ func (pm *ProtocolManager) synchronise(peer *peer) {
return
}
// Make sure the peer's TD is higher than our own
currentBlock := pm.blockchain.CurrentBlock()
td := pm.blockchain.GetTd(currentBlock.Hash(), currentBlock.NumberU64())
currentHeader := pm.blockchain.CurrentHeader()
td := pm.blockchain.GetTd(currentHeader.Hash(), currentHeader.Number.Uint64())
pHead, pTd := peer.Head()
if pTd.Cmp(td) <= 0 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment