Remove the concept of unfiltered networks

This commit is contained in:
nicolas.dorier 2020-07-30 11:36:02 +09:00
parent 26112a1ed6
commit 1fb75c908b
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE
5 changed files with 8 additions and 7 deletions

View File

@ -22,7 +22,6 @@ namespace BTCPayServer
BTCPayNetworkProvider(BTCPayNetworkProvider unfiltered, string[] cryptoCodes)
{
UnfilteredNetworks = unfiltered.UnfilteredNetworks ?? unfiltered;
NetworkType = unfiltered.NetworkType;
_NBXplorerNetworkProvider = new NBXplorerNetworkProvider(unfiltered.NetworkType);
_Networks = new Dictionary<string, BTCPayNetworkBase>();
@ -36,12 +35,10 @@ namespace BTCPayServer
}
}
public BTCPayNetworkProvider UnfilteredNetworks { get; }
public NetworkType NetworkType { get; private set; }
public BTCPayNetworkProvider(NetworkType networkType)
{
UnfilteredNetworks = this;
_NBXplorerNetworkProvider = new NBXplorerNetworkProvider(networkType);
NetworkType = networkType;
InitBitcoin();

View File

@ -64,7 +64,6 @@ namespace BTCPayServer.Data
{
if (storeData == null)
throw new ArgumentNullException(nameof(storeData));
networks = networks.UnfilteredNetworks;
#pragma warning disable CS0618
bool btcReturned = false;

View File

@ -26,7 +26,7 @@ namespace BTCPayServer.Services
{
public BTCPayNetworkJsonSerializerSettings(BTCPayNetworkProvider networkProvider, IEnumerable<IJsonConverterRegistration> jsonSerializers)
{
foreach (var network in networkProvider.UnfilteredNetworks.GetAll().OfType<BTCPayNetwork>())
foreach (var network in networkProvider.GetAll().OfType<BTCPayNetwork>())
{
var serializer = new JsonSerializerSettings();
foreach (var jsonSerializer in jsonSerializers)

View File

@ -554,7 +554,12 @@ namespace BTCPayServer.Services.Invoices
r.CryptoCode = paymentMethodId.CryptoCode;
r.PaymentType = paymentMethodId.PaymentType.ToString();
r.ParentEntity = this;
r.Network = Networks?.UnfilteredNetworks.GetNetwork<BTCPayNetworkBase>(r.CryptoCode);
if (Networks != null)
{
r.Network = Networks.GetNetwork<BTCPayNetworkBase>(r.CryptoCode);
if (r.Network is null)
continue;
}
paymentMethods.Add(r);
}
}

View File

@ -45,7 +45,7 @@ retry:
catch when (retryCount++ < 5) { goto retry; }
_IndexerThread = new CustomThreadPool(1, "Invoice Indexer");
_ContextFactory = contextFactory;
_Networks = networks.UnfilteredNetworks;
_Networks = networks;
}
public InvoiceEntity CreateNewInvoice()