aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--peer.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/peer.go b/peer.go
index 24dbe88d3..e9551e066 100644
--- a/peer.go
+++ b/peer.go
@@ -539,7 +539,15 @@ func (p *Peer) HandleInbound() {
p.lastBlockReceived = time.Now()
}
case ethwire.MsgNewBlockTy:
- p.ethereum.blockPool.AddNew(ethchain.NewBlockFromRlpValue(msg.Data), p)
+ var (
+ blockPool = p.ethereum.blockPool
+ block = ethchain.NewBlockFromRlpValue(msg.Data.Get(0))
+ td = msg.Data.Get(1).BigInt()
+ )
+
+ if td.Cmp(blockPool.td) > 0 {
+ p.ethereum.blockPool.AddNew(block, p)
+ }
}
}