public static LightningNodeInformation ToLightningNodeInformation(GetInfoResponse info) { var pubkey = new PubKey(info.Id); var nodeInfo = new LightningNodeInformation() { BlockHeight = info.BlockHeight }; if (info.Address != null) { nodeInfo.NodeInfoList.AddRange(info.Address.Select(addr => new NodeInfo(pubkey, addr.Address, addr.Port == 0 ? 9735 : addr.Port))); } return(nodeInfo); }
public static LightningNodeInformation ToLightningNodeInformation(GetInfoResponse info) { var pubkey = new PubKey(info.Id); var nodeInfos = info.Address.Select(addr => new NodeInfo(pubkey, addr.Address, addr.Port == 0 ? 9735 : addr.Port)).ToList(); if (nodeInfos.Count == 0) { nodeInfos.Add(new NodeInfo(pubkey, "127.0.0.1", 9735)); } return(new LightningNodeInformation() { NodeInfoList = nodeInfos, BlockHeight = info.BlockHeight }); }
public static LightningNodeInformation ToLightningNodeInformation(GetInfoResponse info) { var addr = info.Address.FirstOrDefault(); if (addr == null) { addr = new GetInfoResponse.GetInfoAddress(); addr.Address = "127.0.0.1"; } if (addr.Port == 0) { addr.Port = 9735; } return(new LightningNodeInformation() { NodeInfo = new NodeInfo(new PubKey(info.Id), addr.Address, addr.Port), BlockHeight = info.BlockHeight }); }