watchtowerrpc: updated comments

This commit is contained in:
Satarupa Deb
2023-04-05 19:36:14 +05:30
committed by Oliver Gugger
parent acee1d77aa
commit 3835c371c9

View File

@@ -144,24 +144,29 @@ func (r *ServerShell) CreateSubServer(configRegistry lnrpc.SubServerConfigDispat
return subServer, macPermissions, nil return subServer, macPermissions, nil
} }
// AddTower adds a new watchtower reachable at the given address and considers // GetInfo returns information about the Lightning node that this Handler
// it for new sessions. If the watchtower already exists, then any new addresses // instance represents. This information includes the node's public key, a list
// included will be considered when dialing it for session negotiations and // of network addresses that the tower is listening on, and a list of URIs that
// backups. // the node is reachable at.
func (c *Handler) GetInfo(ctx context.Context, func (c *Handler) GetInfo(ctx context.Context,
req *GetInfoRequest) (*GetInfoResponse, error) { req *GetInfoRequest) (*GetInfoResponse, error) {
// Check if the node is active.
if err := c.isActive(); err != nil { if err := c.isActive(); err != nil {
return nil, err return nil, err
} }
// Retrieve the node's public key.
pubkey := c.cfg.Tower.PubKey().SerializeCompressed() pubkey := c.cfg.Tower.PubKey().SerializeCompressed()
// Retrieve a list of network addresses that the tower is listening on.
var listeners []string var listeners []string
for _, addr := range c.cfg.Tower.ListeningAddrs() { for _, addr := range c.cfg.Tower.ListeningAddrs() {
listeners = append(listeners, addr.String()) listeners = append(listeners, addr.String())
} }
// Retrieve a list of external IP addresses that the node is reachable
// at.
var uris []string var uris []string
for _, addr := range c.cfg.Tower.ExternalIPs() { for _, addr := range c.cfg.Tower.ExternalIPs() {
uris = append(uris, fmt.Sprintf("%x@%v", pubkey, addr)) uris = append(uris, fmt.Sprintf("%x@%v", pubkey, addr))