fix nre on local coord

This commit is contained in:
Kukks
2023-05-12 14:52:44 +02:00
parent 00f7cb00e4
commit f37edbd9bf
3 changed files with 16 additions and 10 deletions

View File

@@ -13,7 +13,7 @@
<PropertyGroup>
<Product>Wabisabi Coinjoin</Product>
<Description>Allows you to integrate your btcpayserver store with coinjoins.</Description>
<Version>1.0.40</Version>
<Version>1.0.41</Version>
</PropertyGroup>
<!-- Plugin development properties -->

View File

@@ -175,6 +175,11 @@ public class WabisabiCoordinatorService : PeriodicRunner
_httpClientFactory);
HostedServices.Register<WabiSabiCoordinator>(() => WabiSabiCoordinator, "WabiSabi Coordinator");
var settings = await GetSettings();
if (settings.Enabled)
{
_ = StartCoordinator(cancellationToken);
}
if (settings.DiscoveredCoordinators?.Any() is true)
{
foreach (var discoveredCoordinator in settings.DiscoveredCoordinators)
@@ -182,10 +187,6 @@ public class WabisabiCoordinatorService : PeriodicRunner
_instanceManager.AddCoordinator(discoveredCoordinator.Name, discoveredCoordinator.Name, _ => discoveredCoordinator.Uri, null, discoveredCoordinator.Description );
}
}
if (settings.Enabled)
{
_ = StartCoordinator(cancellationToken);
}
await base.StartAsync(cancellationToken);
}

View File

@@ -92,13 +92,18 @@ public class WabisabiCoordinatorClientInstanceManager:IHostedService
return;
}
var url = fetcher.Invoke(_provider).AbsoluteUri;
url = url.EndsWith("/")
? url
: url + "/";
var url = fetcher.Invoke(_provider)?.AbsoluteUri;
if (url is not null)
{
url = url.EndsWith("/") is true
? url
: url + "/";
}
var instance = new WabisabiCoordinatorClientInstance(
displayName,
name, new Uri(url), _provider.GetService<ILoggerFactory>(), _provider, UTXOLocker,
name, url is null? null: new Uri(url), _provider.GetService<ILoggerFactory>(), _provider, UTXOLocker,
_provider.GetService<WalletProvider>(), termsConditions, description);
if (HostedServices.TryAdd(instance.CoordinatorName, instance))
{