Build WasabiSyncer
MODIFY
WalletWasabi/Helpers/Guard.cs
WalletWasabi/Helpers/Guard.cs
@@ -113,38 +113,43 @@ namespace WalletWasabi.Helpers
}
}
- public static int MinimumAndNotNull(string parameterName, int? value, int smallest)
+ public static T MinimumAndNotNull<T>(string parameterName, T value, T smallest) where T : IComparable
{
NotNull(parameterName, value);
- if (value < smallest)
+ if (value.CompareTo(smallest) < 0)
{
throw new ArgumentOutOfRangeException(parameterName, value, $"Parameter cannot be less than {smallest}.");
}
- return (int)value;
+ return value;
}
- public static int MaximumAndNotNull(string parameterName, int? value, int greatest)
+ public static T MaximumAndNotNull<T>(string parameterName, T value, T greatest) where T : IComparable
{
NotNull(parameterName, value);
- if (value > greatest)
+ if (value.CompareTo(greatest) > 0)
{
throw new ArgumentOutOfRangeException(parameterName, value, $"Parameter cannot be greater than {greatest}.");
}
- return (int)value;
+ return value;
}
public static T InRangeAndNotNull<T>(string parameterName, T value, T smallest, T greatest) where T : IComparable
{
NotNull(parameterName, value);
+
if (value.CompareTo(smallest) < 0)
+ {
throw new ArgumentOutOfRangeException(parameterName, value, $"Parameter cannot be less than {smallest}.");
+ }
if (value.CompareTo(greatest) > 0)
+ {
throw new ArgumentOutOfRangeException(parameterName, value, $"Parameter cannot be greater than {greatest}.");
+ }
return value;
}

MODIFY
WalletWasabi/Services/IndexDownloader.cs
WalletWasabi/Services/IndexDownloader.cs
@@ -211,6 +211,8 @@ namespace WalletWasabi.Services
{
filtersResponse = await WasabiClient.GetFiltersAsync(BestKnownFilter.BlockHash, 1000, Cancel.Token).WithAwaitCancellationAsync(Cancel.Token, 300);
// NOT GenSocksServErr
+ BackendStatus = BackendStatus.Connected;
+ TorStatus = TorStatus.Running;
DoNotGenSocksServFail();
}
catch (ConnectionException ex)
@@ -218,16 +220,13 @@ namespace WalletWasabi.Services
TorStatus = TorStatus.NotRunning;
BackendStatus = BackendStatus.NotConnected;
HandleIfGenSocksServFail(ex);
-
throw;
}
catch (TorSocks5FailureResponseException ex)
{
TorStatus = TorStatus.Running;
BackendStatus = BackendStatus.NotConnected;
-
HandleIfGenSocksServFail(ex);
-
throw;
}
catch (Exception ex)
@@ -235,11 +234,8 @@ namespace WalletWasabi.Services
TorStatus = TorStatus.Running;
BackendStatus = BackendStatus.Connected;
HandleIfGenSocksServFail(ex);
-
throw;
}
- BackendStatus = BackendStatus.Connected;
- TorStatus = TorStatus.Running;
if (filtersResponse is null) // no-content, we are synced
{

MODIFY
WalletWasabi/TorSocks5/TorHttpClient.cs
WalletWasabi/TorSocks5/TorHttpClient.cs
@@ -47,7 +47,7 @@ namespace WalletWasabi.TorSocks5
public TorSocks5Client TorSocks5Client { get; private set; }
- private static AsyncLock AsyncLock { get; } = new AsyncLock(); // We make everything synchronous, so slow, but at least stable
+ private static AsyncLock AsyncLock { get; } = new AsyncLock(); // We make everything synchronous, so slow, but at least stable.
public TorHttpClient(Uri baseUri, IPEndPoint torSocks5EndPoint, bool isolateStream = false)
{

Build WasabiSyncer