aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
}