aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-08-19 23:19:37 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-08-19 23:19:37 +0800
commit382d35bf403ab5dd9b0d2fe3a87c3960902d6e57 (patch)
treebfd5ad48a09abafb72e081fa1d19ea37f505b757
parentc6a11fe372a5d515f443256484434dbc5c21dfa1 (diff)
parent941920f2aa651abc6bd72deda09f62d77aeaa2bf (diff)
downloadgo-tangerine-382d35bf403ab5dd9b0d2fe3a87c3960902d6e57.tar.gz
go-tangerine-382d35bf403ab5dd9b0d2fe3a87c3960902d6e57.tar.zst
go-tangerine-382d35bf403ab5dd9b0d2fe3a87c3960902d6e57.zip
Merge pull request #1688 from karalabe/fix-double-imports
eth: fix an issue with pulling and inserting blocks twice
-rw-r--r--eth/handler.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/eth/handler.go b/eth/handler.go
index 2bd369901..5d233dd96 100644
--- a/eth/handler.go
+++ b/eth/handler.go
@@ -413,10 +413,12 @@ 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)
- 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: