LightningConnectionString can parse gRPC

This commit is contained in:
nicolas.dorier 2018-07-23 11:11:00 +09:00
parent 57bb980526
commit 624252e4ad
2 changed files with 13 additions and 3 deletions

View File

@ -81,6 +81,12 @@ namespace BTCPayServer.Controllers
return View(vm);
}
if(connectionString.ConnectionType == LightningConnectionType.LndGRPC)
{
ModelState.AddModelError(nameof(vm.ConnectionString), $"BTCPay does not support gRPC connections");
return View(vm);
}
var internalDomain = internalLightning?.BaseUri?.DnsSafeHost;
bool isInternalNode = connectionString.ConnectionType == LightningConnectionType.CLightning ||

View File

@ -15,7 +15,8 @@ namespace BTCPayServer.Payments.Lightning
{
Charge,
CLightning,
LndREST
LndREST,
LndGRPC
}
public class LightningConnectionString
{
@ -27,6 +28,7 @@ namespace BTCPayServer.Payments.Lightning
typeMapping.Add("clightning", LightningConnectionType.CLightning);
typeMapping.Add("charge", LightningConnectionType.Charge);
typeMapping.Add("lnd-rest", LightningConnectionType.LndREST);
typeMapping.Add("lnd-grpc", LightningConnectionType.LndGRPC);
typeMappingReverse = new Dictionary<LightningConnectionType, string>();
foreach (var kv in typeMapping)
{
@ -161,6 +163,7 @@ namespace BTCPayServer.Payments.Lightning
}
break;
case LightningConnectionType.LndREST:
case LightningConnectionType.LndGRPC:
{
var server = Take(keyValues, "server");
if (server == null)
@ -393,6 +396,7 @@ namespace BTCPayServer.Payments.Lightning
builder.Append($";server={BaseUri}");
break;
case LightningConnectionType.LndREST:
case LightningConnectionType.LndGRPC:
if (Username == null)
{
builder.Append($";server={BaseUri}");