Don't handshake if there is no key yet; first start on Ethereal

This commit is contained in:
Maran 2014-05-26 11:47:47 +02:00
parent 4c7bd75c1a
commit 24a6d87c3f
1 changed files with 8 additions and 5 deletions

13
peer.go
View File

@ -531,13 +531,16 @@ func (p *Peer) Stop() {
}
func (p *Peer) pushHandshake() error {
pubkey := ethutil.GetKeyRing().Get(0).PublicKey
keyRing := ethutil.GetKeyRing().Get(0)
if keyRing != nil {
pubkey := keyRing.PublicKey
msg := ethwire.NewMessage(ethwire.MsgHandshakeTy, []interface{}{
uint32(ProtocolVersion), uint32(0), p.Version, byte(p.caps), p.port, pubkey[1:],
})
msg := ethwire.NewMessage(ethwire.MsgHandshakeTy, []interface{}{
uint32(ProtocolVersion), uint32(0), p.Version, byte(p.caps), p.port, pubkey[1:],
})
p.QueueMessage(msg)
p.QueueMessage(msg)
}
return nil
}