mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-06-29 18:10:48 +02:00
lnd: add new "perm" bit to the ConnectPeer RPC call
This commit modifies the ConnectPeer RPC call and partitions the behavior of the call into two scenarios: the connection should be persistent which causes the call to be non-blocking, and the connection should only attempt to connect once — which causes the call to be blocking and report any error back to the caller. As a result, the pendingConnRequest map and the logic around it is no longer needed.
This commit is contained in:
@ -215,15 +215,13 @@ func (r *rpcServer) ConnectPeer(ctx context.Context,
|
||||
ChainNet: activeNetParams.Net,
|
||||
}
|
||||
|
||||
peerID, err := r.server.ConnectToPeer(peerAddr)
|
||||
if err != nil {
|
||||
if err := r.server.ConnectToPeer(peerAddr, in.Perm); err != nil {
|
||||
rpcsLog.Errorf("(connectpeer): error connecting to peer: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO(roasbeef): add pubkey return
|
||||
rpcsLog.Debugf("Connected to peer: %v", peerAddr.String())
|
||||
return &lnrpc.ConnectPeerResponse{peerID}, nil
|
||||
return &lnrpc.ConnectPeerResponse{}, nil
|
||||
}
|
||||
|
||||
// OpenChannel attempts to open a singly funded channel specified in the
|
||||
|
Reference in New Issue
Block a user