mirror of https://github.com/status-im/op-geth.git
Check if version in known + fix
This commit is contained in:
parent
28a146d438
commit
449b9a9d68
|
@ -160,7 +160,7 @@ func (s *Ethereum) IsUpToDate() bool {
|
||||||
upToDate := true
|
upToDate := true
|
||||||
eachPeer(s.peers, func(peer *Peer, e *list.Element) {
|
eachPeer(s.peers, func(peer *Peer, e *list.Element) {
|
||||||
if atomic.LoadInt32(&peer.connected) == 1 {
|
if atomic.LoadInt32(&peer.connected) == 1 {
|
||||||
if peer.catchingUp == true {
|
if peer.catchingUp == true && peer.versionKnown {
|
||||||
upToDate = false
|
upToDate = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
7
peer.go
7
peer.go
|
@ -328,6 +328,7 @@ func (p *Peer) HandleInbound() {
|
||||||
for _, msg := range msgs {
|
for _, msg := range msgs {
|
||||||
peerlogger.DebugDetailf("(%v) => %v %v\n", p.conn.RemoteAddr(), msg.Type, msg.Data)
|
peerlogger.DebugDetailf("(%v) => %v %v\n", p.conn.RemoteAddr(), msg.Type, msg.Data)
|
||||||
|
|
||||||
|
nextMsg:
|
||||||
switch msg.Type {
|
switch msg.Type {
|
||||||
case ethwire.MsgHandshakeTy:
|
case ethwire.MsgHandshakeTy:
|
||||||
// Version message
|
// Version message
|
||||||
|
@ -373,6 +374,7 @@ func (p *Peer) HandleInbound() {
|
||||||
p.diverted = false
|
p.diverted = false
|
||||||
if !p.ethereum.StateManager().BlockChain().FindCanonicalChainFromMsg(msg, block.PrevHash) {
|
if !p.ethereum.StateManager().BlockChain().FindCanonicalChainFromMsg(msg, block.PrevHash) {
|
||||||
p.SyncWithPeerToLastKnown()
|
p.SyncWithPeerToLastKnown()
|
||||||
|
break nextMsg
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -385,10 +387,11 @@ func (p *Peer) HandleInbound() {
|
||||||
p.blocksRequested = p.blocksRequested * 2
|
p.blocksRequested = p.blocksRequested * 2
|
||||||
|
|
||||||
peerlogger.Infof("No common ancestor found, requesting %d more blocks.\n", p.blocksRequested)
|
peerlogger.Infof("No common ancestor found, requesting %d more blocks.\n", p.blocksRequested)
|
||||||
p.catchingUp = false
|
|
||||||
p.FindCommonParentBlock()
|
p.FindCommonParentBlock()
|
||||||
break
|
break nextMsg
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.catchingUp = false
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := msg.Data.Len() - 1; i >= 0; i-- {
|
for i := msg.Data.Len() - 1; i >= 0; i-- {
|
||||||
|
|
Loading…
Reference in New Issue