diff options
author | obscuren <geffobscura@gmail.com> | 2014-07-18 17:57:44 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-07-18 17:57:44 +0800 |
commit | 449b9a9d688eaf6a8628a3ae9fa1dd3496f99c71 (patch) | |
tree | ae5f02aed89abb1dd4d8856aeeede7cdae12c219 | |
parent | 28a146d438b0c11820aef5d9551c6eff929acdec (diff) | |
download | dexon-449b9a9d688eaf6a8628a3ae9fa1dd3496f99c71.tar dexon-449b9a9d688eaf6a8628a3ae9fa1dd3496f99c71.tar.gz dexon-449b9a9d688eaf6a8628a3ae9fa1dd3496f99c71.tar.bz2 dexon-449b9a9d688eaf6a8628a3ae9fa1dd3496f99c71.tar.lz dexon-449b9a9d688eaf6a8628a3ae9fa1dd3496f99c71.tar.xz dexon-449b9a9d688eaf6a8628a3ae9fa1dd3496f99c71.tar.zst dexon-449b9a9d688eaf6a8628a3ae9fa1dd3496f99c71.zip |
Check if version in known + fix
-rw-r--r-- | ethereum.go | 2 | ||||
-rw-r--r-- | peer.go | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/ethereum.go b/ethereum.go index f43d37be2..18c1f8a23 100644 --- a/ethereum.go +++ b/ethereum.go @@ -160,7 +160,7 @@ func (s *Ethereum) IsUpToDate() bool { upToDate := true eachPeer(s.peers, func(peer *Peer, e *list.Element) { if atomic.LoadInt32(&peer.connected) == 1 { - if peer.catchingUp == true { + if peer.catchingUp == true && peer.versionKnown { upToDate = false } } @@ -328,6 +328,7 @@ func (p *Peer) HandleInbound() { for _, msg := range msgs { peerlogger.DebugDetailf("(%v) => %v %v\n", p.conn.RemoteAddr(), msg.Type, msg.Data) + nextMsg: switch msg.Type { case ethwire.MsgHandshakeTy: // Version message @@ -373,6 +374,7 @@ func (p *Peer) HandleInbound() { p.diverted = false if !p.ethereum.StateManager().BlockChain().FindCanonicalChainFromMsg(msg, block.PrevHash) { p.SyncWithPeerToLastKnown() + break nextMsg } break } @@ -385,10 +387,11 @@ func (p *Peer) HandleInbound() { p.blocksRequested = p.blocksRequested * 2 peerlogger.Infof("No common ancestor found, requesting %d more blocks.\n", p.blocksRequested) - p.catchingUp = false p.FindCommonParentBlock() - break + break nextMsg } + + p.catchingUp = false } for i := msg.Data.Len() - 1; i >= 0; i-- { |