try-catch event subscribers
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
@@ -184,6 +184,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
private void InitializeAddresses()
+ {
+ try
{
_addresses?.Clear();
var walletService = Global.WalletService;
@@ -199,6 +201,11 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
_addresses.Add(new AddressViewModel(key, Global));
}
}
+ catch(Exception ex)
+ {
+ Logger.LogError(ex);
+ }
+ }
public ObservableCollection<AddressViewModel> Addresses
{

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/WalletViewModel.cs
@@ -9,6 +9,7 @@ using System.Reactive.Disposables;
using System.Reactive.Linq;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Services;
+using WalletWasabi.Logging;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
@@ -93,23 +94,26 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
Disposables = Disposables is null ? new CompositeDisposable() : throw new NotSupportedException($"Cannot open {GetType().Name} before closing it.");
- var observed = Observable.Merge(
- Global.UiConfig.WhenAnyValue(x => x.LurkingWifeMode).Select(_ => Unit.Default),
+ Observable.Merge(
Observable.FromEventPattern(Global.WalletService.TransactionProcessor, nameof(Global.WalletService.TransactionProcessor.CoinReceived)).Select(_ => Unit.Default),
Observable.FromEventPattern(Global.WalletService.TransactionProcessor, nameof(Global.WalletService.TransactionProcessor.CoinSpent)).Select(_ => Unit.Default))
- .Throttle(TimeSpan.FromSeconds(1))
- .ObserveOn(RxApp.MainThreadScheduler);
-
- observed.Subscribe(_ =>
+ .Throttle(TimeSpan.FromSeconds(0.5))
+ .Merge(Global.UiConfig.WhenAnyValue(x => x.LurkingWifeMode).Select(_ => Unit.Default))
+ .ObserveOn(RxApp.MainThreadScheduler)
+ .Subscribe(_ =>
+ {
+ try
{
Money balance = WalletService.Coins.TotalAmount();
-
Title = $"{Name} ({(Global.UiConfig.LurkingWifeMode ? "#########" : balance.ToString(false, true))} BTC)";
+ }
+ catch (Exception ex)
+ {
+ Logger.LogError(ex);
+ }
})
.DisposeWith(Disposables);
- observed.Next();
-
IsExpanded = true;
}

MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -145,27 +145,34 @@ namespace WalletWasabi.Services
}
private void TransactionProcessor_CoinSpent(object sender, SmartCoin spentCoin)
+ {
+ try
{
ChaumianClient.ExposedLinks.TryRemove(spentCoin.GetTxoRef(), out _);
}
+ catch(Exception ex)
+ {
+ Logger.LogError(ex);
+ }
+ }
private async void TransactionProcessor_CoinReceivedAsync(object sender, SmartCoin newCoin)
+ {
+ try
{
// If it's being mixed and anonset is not sufficient, then queue it.
if (newCoin.Unspent && ChaumianClient.HasIngredients
&& newCoin.AnonymitySet < ServiceConfiguration.MixUntilAnonymitySet
&& ChaumianClient.State.Contains(newCoin.SpentOutputs))
- {
- try
{
await ChaumianClient.QueueCoinsToMixAsync(newCoin);
}
+ }
catch (Exception ex)
{
Logger.LogError(ex);
}
}
- }
private void Mempool_TransactionReceived(object sender, SmartTransaction tx)
{

try-catch event subscribers