aboutsummaryrefslogtreecommitdiffstats
path: root/peer.go
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-05-26 17:47:47 +0800
committerMaran <maran.hidskes@gmail.com>2014-05-26 17:47:47 +0800
commit24a6d87c3f4bc69fdd1c619b36f8b74a61fd8bae (patch)
treea30dc63ada2e32609b07a8b2bfb70409908c678a /peer.go
parent4c7bd75c1a4ccbed09a10c81dbfbbcffdc66c411 (diff)
downloadgo-tangerine-24a6d87c3f4bc69fdd1c619b36f8b74a61fd8bae.tar.gz
go-tangerine-24a6d87c3f4bc69fdd1c619b36f8b74a61fd8bae.tar.zst
go-tangerine-24a6d87c3f4bc69fdd1c619b36f8b74a61fd8bae.zip
Don't handshake if there is no key yet; first start on Ethereal
Diffstat (limited to 'peer.go')
-rw-r--r--peer.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/peer.go b/peer.go
index 7e505d680..d613bf6ff 100644
--- a/peer.go
+++ b/peer.go
@@ -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
}