do not crash if cookiefile invalid

This commit is contained in:
NicolasDorier 2017-09-15 01:03:27 +09:00
parent a3ea94c771
commit efcda9a45e
2 changed files with 8 additions and 5 deletions

View File

@ -11,10 +11,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Filter" Version="1.1.2" />
<PackageReference Include="NBitcoin" Version="4.0.0.34" />
<PackageReference Include="NBitcoin" Version="4.0.0.38" />
<PackageReference Include="NBitpayClient" Version="1.0.0.6" />
<PackageReference Include="DBreeze" Version="1.87.0" />
<PackageReference Include="NBXplorer.Client" Version="1.0.0.7" />
<PackageReference Include="NBXplorer.Client" Version="1.0.0.9" />
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
<PackageReference Include="System.Xml.XmlSerializer" Version="4.0.11" />
</ItemGroup>

View File

@ -34,8 +34,11 @@ namespace BTCPayServer.Configuration
{
Network = opts.Network;
Explorer = new ExplorerClient(opts.Network, opts.Explorer);
Explorer.SetCookieFile(opts.CookieFile);
CancellationTokenSource cts = new CancellationTokenSource(5000);
if(!Explorer.SetCookieAuth(opts.CookieFile))
Explorer.SetNoAuth();
CancellationTokenSource cts = new CancellationTokenSource(10000);
try
{
Logs.Configuration.LogInformation("Trying to connect to explorer " + Explorer.Address.AbsoluteUri);
@ -84,7 +87,7 @@ namespace BTCPayServer.Configuration
_Resources.Clear();
}
}
public Network Network
{
get;