mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-02-23 15:14:49 +01:00
Refactor how we handle and validate LN ConnectionStrings (#2314)
* Refactor how we handle and validate LN ConnectionStrings * Migrate existing connection string to Internal Node if they are the same. Cleanup some obsolete fields * Fix typos, remove duplicated method * Add a InternalNodeRef to LightningSupportedPaymentMethod
This commit is contained in:
@@ -69,14 +69,6 @@ namespace BTCPayServer.Data
|
||||
#pragma warning disable CS0618
|
||||
bool btcReturned = false;
|
||||
|
||||
// Legacy stuff which should go away
|
||||
if (!string.IsNullOrEmpty(storeData.DerivationStrategy))
|
||||
{
|
||||
btcReturned = true;
|
||||
yield return DerivationSchemeSettings.Parse(storeData.DerivationStrategy, networks.BTC);
|
||||
}
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(storeData.DerivationStrategies))
|
||||
{
|
||||
JObject strategies = JObject.Parse(storeData.DerivationStrategies);
|
||||
@@ -130,11 +122,6 @@ namespace BTCPayServer.Data
|
||||
foreach (var strat in strategies.Properties().ToList())
|
||||
{
|
||||
var stratId = PaymentMethodId.Parse(strat.Name);
|
||||
if (stratId.IsBTCOnChain)
|
||||
{
|
||||
// Legacy stuff which should go away
|
||||
storeData.DerivationStrategy = null;
|
||||
}
|
||||
if (stratId == paymentMethodId)
|
||||
{
|
||||
if (supportedPaymentMethod == null)
|
||||
@@ -149,12 +136,7 @@ namespace BTCPayServer.Data
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!existing && supportedPaymentMethod == null && paymentMethodId.IsBTCOnChain)
|
||||
{
|
||||
storeData.DerivationStrategy = null;
|
||||
}
|
||||
else if (!existing && supportedPaymentMethod != null)
|
||||
if (!existing && supportedPaymentMethod != null)
|
||||
strategies.Add(new JProperty(supportedPaymentMethod.PaymentId.ToString(), PaymentMethodExtensions.Serialize(supportedPaymentMethod)));
|
||||
storeData.DerivationStrategies = strategies.ToString();
|
||||
#pragma warning restore CS0618
|
||||
|
||||
Reference in New Issue
Block a user