From bd7aca76e1c68ec4d6f76468a250a83f4edd0545 Mon Sep 17 00:00:00 2001 From: obscuren Date: Wed, 8 Oct 2014 12:33:33 +0200 Subject: [PATCH] Proper new block --- peer.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/peer.go b/peer.go index 24dbe88d3f..e9551e0668 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) + } } }