Commit 382d35bf authored by Jeffrey Wilcke's avatar Jeffrey Wilcke

Merge pull request #1688 from karalabe/fix-double-imports

eth: fix an issue with pulling and inserting blocks twice
parents c6a11fe3 941920f2
...@@ -413,10 +413,12 @@ func (pm *ProtocolManager) handleMsg(p *peer) error { ...@@ -413,10 +413,12 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
pm.fetcher.Enqueue(p.id, request.Block) 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 { if request.TD.Cmp(p.Td()) > 0 {
p.SetTd(request.TD) p.SetTd(request.TD)
go pm.synchronise(p) if request.TD.Cmp(new(big.Int).Add(pm.chainman.Td(), request.Block.Difficulty())) > 0 {
go pm.synchronise(p)
}
} }
case TxMsg: case TxMsg:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment