aboutsummaryrefslogtreecommitdiffstats
path: root/peer.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-10-08 18:33:33 +0800
committerobscuren <geffobscura@gmail.com>2014-10-08 18:33:33 +0800
commitbd7aca76e1c68ec4d6f76468a250a83f4edd0545 (patch)
treefa2010d263793787b9088012902740d7bd58fbd3 /peer.go
parent4de3ad1712ce0fdc62b1acc27a3922b192e943c6 (diff)
downloaddexon-bd7aca76e1c68ec4d6f76468a250a83f4edd0545.tar
dexon-bd7aca76e1c68ec4d6f76468a250a83f4edd0545.tar.gz
dexon-bd7aca76e1c68ec4d6f76468a250a83f4edd0545.tar.bz2
dexon-bd7aca76e1c68ec4d6f76468a250a83f4edd0545.tar.lz
dexon-bd7aca76e1c68ec4d6f76468a250a83f4edd0545.tar.xz
dexon-bd7aca76e1c68ec4d6f76468a250a83f4edd0545.tar.zst
dexon-bd7aca76e1c68ec4d6f76468a250a83f4edd0545.zip
Proper new block
Diffstat (limited to 'peer.go')
-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)
+ }
}
}