Changed catching up code & peer handler
* Peers should be added no matter what * Catch up with _anyone_
This commit is contained in:
parent
cbd71ef8f5
commit
306b5bcff3
21
peer.go
21
peer.go
|
@ -122,9 +122,6 @@ type Peer struct {
|
||||||
|
|
||||||
// Last received pong message
|
// Last received pong message
|
||||||
lastPong int64
|
lastPong int64
|
||||||
// Indicates whether a MsgGetPeersTy was requested of the peer
|
|
||||||
// this to prevent receiving false peers.
|
|
||||||
requestedPeerList bool
|
|
||||||
|
|
||||||
host []byte
|
host []byte
|
||||||
port uint16
|
port uint16
|
||||||
|
@ -463,9 +460,6 @@ func (p *Peer) HandleInbound() {
|
||||||
p.ethereum.TxPool().QueueTransaction(tx)
|
p.ethereum.TxPool().QueueTransaction(tx)
|
||||||
}
|
}
|
||||||
case ethwire.MsgGetPeersTy:
|
case ethwire.MsgGetPeersTy:
|
||||||
// Flag this peer as a 'requested of new peers' this to
|
|
||||||
// prevent malicious peers being forced.
|
|
||||||
p.requestedPeerList = true
|
|
||||||
// Peer asked for list of connected peers
|
// Peer asked for list of connected peers
|
||||||
p.pushPeers()
|
p.pushPeers()
|
||||||
case ethwire.MsgPeersTy:
|
case ethwire.MsgPeersTy:
|
||||||
|
@ -481,9 +475,6 @@ func (p *Peer) HandleInbound() {
|
||||||
|
|
||||||
// Connect to the list of peers
|
// Connect to the list of peers
|
||||||
p.ethereum.ProcessPeerList(peers)
|
p.ethereum.ProcessPeerList(peers)
|
||||||
// Mark unrequested again
|
|
||||||
p.requestedPeerList = false
|
|
||||||
|
|
||||||
case ethwire.MsgGetChainTy:
|
case ethwire.MsgGetChainTy:
|
||||||
var parent *ethchain.Block
|
var parent *ethchain.Block
|
||||||
// Length minus one since the very last element in the array is a count
|
// Length minus one since the very last element in the array is a count
|
||||||
|
@ -695,11 +686,13 @@ func (p *Peer) handleHandshake(msg *ethwire.Msg) {
|
||||||
|
|
||||||
ethlogger.Infof("Added peer (%s) %d / %d\n", p.conn.RemoteAddr(), p.ethereum.Peers().Len(), p.ethereum.MaxPeers)
|
ethlogger.Infof("Added peer (%s) %d / %d\n", p.conn.RemoteAddr(), p.ethereum.Peers().Len(), p.ethereum.MaxPeers)
|
||||||
|
|
||||||
// Catch up with the connected peer
|
/*
|
||||||
if !p.ethereum.IsUpToDate() {
|
// Catch up with the connected peer
|
||||||
peerlogger.Debugln("Already syncing up with a peer; sleeping")
|
if !p.ethereum.IsUpToDate() {
|
||||||
time.Sleep(10 * time.Second)
|
peerlogger.Debugln("Already syncing up with a peer; sleeping")
|
||||||
}
|
time.Sleep(10 * time.Second)
|
||||||
|
}
|
||||||
|
*/
|
||||||
p.SyncWithPeerToLastKnown()
|
p.SyncWithPeerToLastKnown()
|
||||||
|
|
||||||
peerlogger.Debugln(p)
|
peerlogger.Debugln(p)
|
||||||
|
|
Loading…
Reference in New Issue