Detect old Tor version.
Resolves:
MODIFY
WalletWasabi.Gui/ViewModels/MainWindowViewModel.cs
WalletWasabi.Gui/ViewModels/MainWindowViewModel.cs
@@ -44,7 +44,11 @@ namespace WalletWasabi.Gui.ViewModels
{
ModalDialog = dialog;
- return await ModalDialog.ShowDialogAsync();
+ bool res = await ModalDialog.ShowDialogAsync();
+
+ ModalDialog = null;
+
+ return res;
}
public ModalDialogViewModelBase ModalDialog

MODIFY
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
@@ -15,6 +15,7 @@ using AvalonStudio.Extensibility;
using AvalonStudio.Shell;
using WalletWasabi.Gui.Tabs;
using System.Reactive.Linq;
+using WalletWasabi.Gui.Dialogs;
namespace WalletWasabi.Gui.ViewModels
{
@@ -172,6 +173,7 @@ namespace WalletWasabi.Gui.ViewModels
IndexDownloader.BestHeightChanged += IndexDownloader_BestHeightChanged;
IndexDownloader.TorStatusChanged += IndexDownloader_TorStatusChanged;
IndexDownloader.BackendStatusChanged += IndexDownloader_BackendStatusChanged;
+ IndexDownloader.ResponseArrivedIsGenSocksServFail += IndexDownloader_ResponseArrivedIsGenSocksServFail;
FiltersLeft = IndexDownloader.GetFiltersLeft();
@@ -222,6 +224,43 @@ namespace WalletWasabi.Gui.ViewModels
}, this.WhenAnyValue(x => x.UpdateStatus).Select(x => x != UpdateStatus.Latest));
}
+ private void IndexDownloader_ResponseArrivedIsGenSocksServFail(object sender, bool isGenSocksServFail)
+ {
+ if (isGenSocksServFail)
+ {
+ // Is close band present?
+ if (MainWindowViewModel.Instance.ModalDialog != null)
+ {
+ // Do nothing.
+ }
+ else
+ {
+ // Show GenSocksServFail dialog.
+ MainWindowViewModel.Instance.ShowDialogAsync(new GenSocksServFailDialogViewModel()).GetAwaiter();
+ }
+ }
+ else
+ {
+ // Is close band present?
+ if (MainWindowViewModel.Instance.ModalDialog != null)
+ {
+ // Is it GenSocksServFail dialog?
+ if (MainWindowViewModel.Instance.ModalDialog is GenSocksServFailDialogViewModel)
+ {
+ MainWindowViewModel.Instance.ModalDialog.Close(true);
+ }
+ else
+ {
+ // Do nothing.
+ }
+ }
+ else
+ {
+ // Do nothing.
+ }
+ }
+ }
+
private void WalletService_ConcurrentBlockDownloadNumberChanged(object sender, int concurrentBlockDownloadNumber)
{
BlocksLeft = concurrentBlockDownloadNumber;
@@ -305,6 +344,7 @@ namespace WalletWasabi.Gui.ViewModels
IndexDownloader.BestHeightChanged -= IndexDownloader_BestHeightChanged;
IndexDownloader.TorStatusChanged -= IndexDownloader_TorStatusChanged;
IndexDownloader.BackendStatusChanged -= IndexDownloader_BackendStatusChanged;
+ IndexDownloader.ResponseArrivedIsGenSocksServFail -= IndexDownloader_ResponseArrivedIsGenSocksServFail;
}
_disposedValue = true;

MODIFY
WalletWasabi/Services/IndexDownloader.cs
WalletWasabi/Services/IndexDownloader.cs
@@ -41,6 +41,8 @@ namespace WalletWasabi.Services
}
}
+ public event EventHandler<bool> ResponseArrivedIsGenSocksServFail;
+
public event EventHandler<Height> BestHeightChanged;
private TorStatus _torStatus;
@@ -208,23 +210,32 @@ namespace WalletWasabi.Services
try
{
filtersResponse = await WasabiClient.GetFiltersAsync(BestKnownFilter.BlockHash, 1000, Cancel.Token).WithAwaitCancellationAsync(Cancel.Token, 300);
+ // NOT GenSocksServErr
+ DoNotGenSocksServFail();
}
- catch (ConnectionException)
+ catch (ConnectionException ex)
{
TorStatus = TorStatus.NotRunning;
BackendStatus = BackendStatus.NotConnected;
+ HandleIfGenSocksServFail(ex);
+
throw;
}
- catch (TorSocks5FailureResponseException)
+ catch (TorSocks5FailureResponseException ex)
{
TorStatus = TorStatus.Running;
BackendStatus = BackendStatus.NotConnected;
+
+ HandleIfGenSocksServFail(ex);
+
throw;
}
- catch
+ catch (Exception ex)
{
TorStatus = TorStatus.Running;
BackendStatus = BackendStatus.Connected;
+ HandleIfGenSocksServFail(ex);
+
throw;
}
BackendStatus = BackendStatus.Connected;
@@ -335,6 +346,31 @@ namespace WalletWasabi.Services
});
}
+ private void HandleIfGenSocksServFail(Exception ex)
+ {
+ // IS GenSocksServFail?
+ if (ex.ToString().Contains("GeneralSocksServerFailure", StringComparison.OrdinalIgnoreCase))
+ {
+ // IS GenSocksServFail
+ DoGenSocksServFail();
+ }
+ else
+ {
+ // NOT GenSocksServFail
+ DoNotGenSocksServFail();
+ }
+ }
+
+ private void DoGenSocksServFail()
+ {
+ ResponseArrivedIsGenSocksServFail?.Invoke(this, true);
+ }
+
+ private void DoNotGenSocksServFail()
+ {
+ ResponseArrivedIsGenSocksServFail?.Invoke(this, false);
+ }
+
public Height GetHeight(uint256 blockHash)
{
using (IndexLock.Lock())

Detect old Tor version.
Resolves: https://github.com/zkSNACKs/WalletWasabi/issues/640