Skip to content

Commit

Permalink
Prevent panic on wrong interface conversion (prysmaticlabs#4803)
Browse files Browse the repository at this point in the history
* Prevent panic on wrong interface conversion
* remove import
  • Loading branch information
prestonvanloon authored and cryptomental committed Feb 24, 2020
1 parent 7d2f1ce commit 4ac193b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion beacon-chain/sync/rpc_goodbye.go
Expand Up @@ -27,7 +27,10 @@ func (r *Service) goodbyeRPCHandler(ctx context.Context, msg interface{}, stream
defer cancel()
setRPCStreamDeadlines(stream)

m := msg.(uint64)
m, ok:= msg.(uint64)
if !ok {
return fmt.Errorf("wrong message type for goodbye, got %T, wanted uint64", msg)
}
log := log.WithField("Reason", goodbyeMessage(m))
log.WithField("peer", stream.Conn().RemotePeer()).Info("Peer has sent a goodbye message")
// closes all streams with the peer
Expand Down

0 comments on commit 4ac193b

Please sign in to comment.