Fix bug about btcpay showing wrong port 0 as public lightning port for charge and clightning

This commit is contained in:
nicolas.dorier
2018-08-27 18:36:08 +09:00
parent 38d810cef7
commit da8a06952c
3 changed files with 13 additions and 6 deletions

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Version>1.0.2.100</Version>
<Version>1.0.2.101</Version>
<NoWarn>NU1701,CA1816,CA1308,CA1810,CA2208</NoWarn>
</PropertyGroup>
<PropertyGroup>

View File

@@ -211,13 +211,21 @@ namespace BTCPayServer.Payments.Lightning.CLightning
async Task<LightningNodeInformation> ILightningInvoiceClient.GetInfo(CancellationToken cancellation)
{
var info = await GetInfoAsync(cancellation);
var address = info.Address.Select(a => a.Address).FirstOrDefault();
var port = info.Port;
var addr = info.Address.FirstOrDefault();
if(addr == null)
{
addr = new Charge.GetInfoResponse.GetInfoAddress();
addr.Address = "127.0.0.1";
}
if(addr.Port == 0)
{
addr.Port = 9735;
}
return new LightningNodeInformation()
{
NodeId = info.Id,
P2PPort = port,
Address = address,
P2PPort = addr.Port,
Address = addr.Address,
BlockHeight = info.BlockHeight
};
}

View File

@@ -15,7 +15,6 @@ namespace BTCPayServer.Payments.Lightning.Charge
public int Port { get; set; }
}
public string Id { get; set; }
public int Port { get; set; }
public GetInfoAddress[] Address { get; set; }
public string Version { get; set; }
public int BlockHeight { get; set; }