rpcserver: allow channels to be opened using --node_id

This commit fixes a slight bug in the interaction between the cli
program and the rpcsever itself. With this commit it’s now again
possible to create a channel with a peer that’s identified by its
peerID, instead of only the pubkey.
This commit is contained in:
Olaoluwa Osuntokun committed 2017-01-14 18:12:28 -08:00
1 parent 8990de4d99
commit 9b4ac77d40
2 files changed
+24 -6

No files matched your search

+10 -2
View File
@@ -713,9 +713,17 @@ func (s *server) handleConnectPeer(msg *connectPeerMsg) {
// request to the funding manager allowing it to initiate the channel funding
// workflow.
func (s *server) handleOpenChanReq(req *openChanReq) {
var targetPeer *peer
var (
targetPeer *peer
pubStr string
)
pubStr := string(req.targetPubkey.SerializeCompressed())
// If the user is targeting the peer by public key, then we'll need to
// convert that into a string for our map. Otherwise, we expect them to
// target by peer ID instead.
if req.targetPubkey != nil {
pubStr = string(req.targetPubkey.SerializeCompressed())
}
// First attempt to locate the target peer to open a channel with, if
// we're unable to locate the peer then this request will fail.