Some refactoring improving performance, and better tests for multiple currencies

This commit is contained in:
nicolas.dorier
2018-01-11 17:29:48 +09:00
parent 55d50af39d
commit 3a91965187
19 changed files with 253 additions and 153 deletions

View File

@@ -46,7 +46,7 @@ namespace BTCPayServer.Configuration
Logs.Configuration.LogInformation("Network: " + Network);
bool btcHandled = false;
foreach (var net in new BTCPayNetworkProvider(Network).GetAll())
{
var nbxplorer = NBXplorer.Configuration.NetworkInformation.GetNetworkByName(net.NBitcoinNetwork.Name);
@@ -54,12 +54,16 @@ namespace BTCPayServer.Configuration
var cookieFile = conf.GetOrDefault<string>($"{net.CryptoCode}.explorer.cookiefile", nbxplorer.GetDefaultCookieFile());
if (explorer != null)
{
#pragma warning disable CS0618
if (net.IsBTC)
btcHandled = true;
#pragma warning restore CS0618
ExplorerFactories.Add(net.CryptoCode, (n) => CreateExplorerClient(n, explorer, cookieFile));
}
}
// Handle legacy explorer.url and explorer.cookiefile
if (ExplorerFactories.Count == 0)
if (!btcHandled)
{
var nbxplorer = NBXplorer.Configuration.NetworkInformation.GetNetworkByName(Network.Name); // Will get BTC info
var explorer = conf.GetOrDefault<Uri>($"explorer.url", new Uri(nbxplorer.GetDefaultExplorerUrl(), UriKind.Absolute));