diff options
author | obscuren <geffobscura@gmail.com> | 2014-10-08 18:33:33 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-10-08 18:33:33 +0800 |
commit | bd7aca76e1c68ec4d6f76468a250a83f4edd0545 (patch) | |
tree | fa2010d263793787b9088012902740d7bd58fbd3 /peer.go | |
parent | 4de3ad1712ce0fdc62b1acc27a3922b192e943c6 (diff) | |
download | dexon-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.go | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -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) + } } } |