aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-04-18 20:25:22 +0800
committerobscuren <geffobscura@gmail.com>2015-04-18 20:25:22 +0800
commiteef4776b5bb9d77a0dab0d9ac8da61fdbc72129f (patch)
treebe2f1692eead48745a9f34375d1ac87ec3f36908 /eth
parent1bc2d83b6f5d0b8ddcd1b1501a5b9554526289ea (diff)
downloaddexon-eef4776b5bb9d77a0dab0d9ac8da61fdbc72129f.tar
dexon-eef4776b5bb9d77a0dab0d9ac8da61fdbc72129f.tar.gz
dexon-eef4776b5bb9d77a0dab0d9ac8da61fdbc72129f.tar.bz2
dexon-eef4776b5bb9d77a0dab0d9ac8da61fdbc72129f.tar.lz
dexon-eef4776b5bb9d77a0dab0d9ac8da61fdbc72129f.tar.xz
dexon-eef4776b5bb9d77a0dab0d9ac8da61fdbc72129f.tar.zst
dexon-eef4776b5bb9d77a0dab0d9ac8da61fdbc72129f.zip
eth: ignore NewBlockMsg with lower td
Diffstat (limited to 'eth')
-rw-r--r--eth/handler.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/eth/handler.go b/eth/handler.go
index 065116fd0..bb12e1904 100644
--- a/eth/handler.go
+++ b/eth/handler.go
@@ -257,8 +257,9 @@ func (self *ProtocolManager) handleMsg(p *peer) error {
})
// Make sure the block isn't already known. If this is the case simply drop
- // the message and move on.
- if self.chainman.HasBlock(hash) {
+ // the message and move on. If the TD is < currentTd; drop it as well. If this
+ // chain at some point becomes canonical, the downloader will fetch it.
+ if self.chainman.HasBlock(hash) && self.chainman.Td().Cmp(request.TD) > 0 {
break
}