rpcserver: allow targeting open channels via global lightning ID

This commit adds the ability to open channels according a node’s
“global” lightning ID in addition to the local relative peer ID.
This commit is contained in:
Olaoluwa Osuntokun
2016-09-13 15:35:41 -07:00
parent 7aaa46d7ff
commit 6c83f53206
2 changed files with 22 additions and 19 deletions

View File

@ -196,18 +196,17 @@ func (r *rpcServer) OpenChannel(in *lnrpc.OpenChannelRequest,
localFundingAmt := btcutil.Amount(in.LocalFundingAmount)
remoteFundingAmt := btcutil.Amount(in.RemoteFundingAmount)
target := in.TargetPeerId
numConfs := in.NumConfs
updateChan, errChan := r.server.OpenChannel(target, localFundingAmt,
remoteFundingAmt, numConfs)
updateChan, errChan := r.server.OpenChannel(in.TargetPeerId,
in.TargetNode, localFundingAmt, remoteFundingAmt, in.NumConfs)
var outpoint wire.OutPoint
out:
for {
select {
case err := <-errChan:
rpcsLog.Errorf("unable to open channel to peerid(%v): %v",
target, err)
rpcsLog.Errorf("unable to open channel to "+
"lightningID(%v) nor peerID(%v): %v",
in.TargetNode, in.TargetPeerId, err)
return err
case fundingUpdate := <-updateChan:
rpcsLog.Tracef("[openchannel] sending update: %v",