Commit bd7aca76 authored by obscuren's avatar obscuren

Proper new block

parent 4de3ad17
...@@ -539,7 +539,15 @@ func (p *Peer) HandleInbound() { ...@@ -539,7 +539,15 @@ func (p *Peer) HandleInbound() {
p.lastBlockReceived = time.Now() p.lastBlockReceived = time.Now()
} }
case ethwire.MsgNewBlockTy: 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)
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment