mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 18:11:36 +01:00
LightningConnectionString can parse gRPC
This commit is contained in:
parent
57bb980526
commit
624252e4ad
@ -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 ||
|
||||
|
@ -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)
|
||||
@ -199,12 +202,12 @@ namespace BTCPayServer.Payments.Lightning
|
||||
var macaroonFilePath = Take(keyValues, "macaroonfilepath");
|
||||
if (macaroonFilePath != null)
|
||||
{
|
||||
if(macaroon != null)
|
||||
if (macaroon != null)
|
||||
{
|
||||
error = $"The key 'macaroon' is already specified";
|
||||
return false;
|
||||
}
|
||||
if(!macaroonFilePath.EndsWith(".macaroon", StringComparison.OrdinalIgnoreCase))
|
||||
if (!macaroonFilePath.EndsWith(".macaroon", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
error = $"The key 'macaroonfilepath' should point to a .macaroon file";
|
||||
return false;
|
||||
@ -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}");
|
||||
|
Loading…
Reference in New Issue
Block a user