mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-03-03 10:03:47 +00:00
Proper new block
This commit is contained in:
parent
4de3ad1712
commit
bd7aca76e1
1 changed files with 9 additions and 1 deletions
10
peer.go
10
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)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue