eth: fix an issue with pulling and inserting blocks twice
This commit is contained in:
parent
3b997c3e16
commit
941920f2aa
@ -413,11 +413,13 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
|
||||
|
||||
pm.fetcher.Enqueue(p.id, request.Block)
|
||||
|
||||
// TODO: Schedule a sync to cover potential gaps (this needs proto update)
|
||||
// Update the peers total difficulty if needed, schedule a download if gapped
|
||||
if request.TD.Cmp(p.Td()) > 0 {
|
||||
p.SetTd(request.TD)
|
||||
if request.TD.Cmp(new(big.Int).Add(pm.chainman.Td(), request.Block.Difficulty())) > 0 {
|
||||
go pm.synchronise(p)
|
||||
}
|
||||
}
|
||||
|
||||
case TxMsg:
|
||||
// Transactions arrived, parse all of them and deliver to the pool
|
||||
|
Loading…
Reference in New Issue
Block a user