forked from cerc-io/plugeth
Re-enabled catching up flag
This commit is contained in:
parent
eaa2e8900d
commit
c44f4f32fe
10
peer.go
10
peer.go
@ -435,6 +435,8 @@ func (p *Peer) HandleInbound() {
|
|||||||
p.QueueMessage(ethwire.NewMessage(ethwire.MsgBlockTy, blocks))
|
p.QueueMessage(ethwire.NewMessage(ethwire.MsgBlockTy, blocks))
|
||||||
|
|
||||||
case ethwire.MsgBlockHashesTy:
|
case ethwire.MsgBlockHashesTy:
|
||||||
|
p.catchingUp = true
|
||||||
|
|
||||||
blockPool := p.ethereum.blockPool
|
blockPool := p.ethereum.blockPool
|
||||||
|
|
||||||
foundCommonHash := false
|
foundCommonHash := false
|
||||||
@ -452,6 +454,8 @@ func (p *Peer) HandleInbound() {
|
|||||||
blockPool.AddHash(hash)
|
blockPool.AddHash(hash)
|
||||||
|
|
||||||
p.lastReceivedHash = hash
|
p.lastReceivedHash = hash
|
||||||
|
|
||||||
|
p.lastBlockReceived = time.Now()
|
||||||
}
|
}
|
||||||
|
|
||||||
if foundCommonHash {
|
if foundCommonHash {
|
||||||
@ -459,14 +463,20 @@ func (p *Peer) HandleInbound() {
|
|||||||
} else {
|
} else {
|
||||||
p.FetchHashes()
|
p.FetchHashes()
|
||||||
}
|
}
|
||||||
|
|
||||||
case ethwire.MsgBlockTy:
|
case ethwire.MsgBlockTy:
|
||||||
|
p.catchingUp = true
|
||||||
|
|
||||||
blockPool := p.ethereum.blockPool
|
blockPool := p.ethereum.blockPool
|
||||||
|
|
||||||
it := msg.Data.NewIterator()
|
it := msg.Data.NewIterator()
|
||||||
|
|
||||||
for it.Next() {
|
for it.Next() {
|
||||||
block := ethchain.NewBlockFromRlpValue(it.Value())
|
block := ethchain.NewBlockFromRlpValue(it.Value())
|
||||||
|
|
||||||
blockPool.SetBlock(block)
|
blockPool.SetBlock(block)
|
||||||
|
|
||||||
|
p.lastBlockReceived = time.Now()
|
||||||
}
|
}
|
||||||
|
|
||||||
linked := blockPool.CheckLinkAndProcess(func(block *ethchain.Block) {
|
linked := blockPool.CheckLinkAndProcess(func(block *ethchain.Block) {
|
||||||
|
Loading…
Reference in New Issue
Block a user