From 4c4207943617442a9209d9d2600f27785f0fc1f5 Mon Sep 17 00:00:00 2001 From: MeshCollider Date: Tue, 20 Feb 2018 11:55:22 +1300 Subject: [PATCH] multi: ensure NodeKey is set in rpc/cli --- rpcserver.go | 5 +++++ server.go | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/rpcserver.go b/rpcserver.go index 2b577c57..c76b1dda 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -720,6 +720,11 @@ func (r *rpcServer) OpenChannel(in *lnrpc.OpenChannelRequest, // TODO(roasbeef): also return channel ID? + // Ensure that the NodePubKey is set before attempting to use it + if len(in.NodePubkey) == 0 { + return fmt.Errorf("NodePubKey is not set") + } + // Parse the raw bytes of the node key into a pubkey object so we // can easily manipulate it. nodePubKey, err = btcec.ParsePubKey(in.NodePubkey, btcec.S256()) diff --git a/server.go b/server.go index 0f0547c9..00fdee28 100644 --- a/server.go +++ b/server.go @@ -1773,7 +1773,7 @@ func (s *server) DisconnectPeer(pubKey *btcec.PublicKey) error { } // OpenChannel sends a request to the server to open a channel to the specified -// peer identified by Public Key with the passed channel funding parameters. +// peer identified by nodeKey with the passed channel funding parameters. // // NOTE: This function is safe for concurrent access. func (s *server) OpenChannel(nodeKey *btcec.PublicKey,