Implement transaction processing percentage feedback
MODIFY
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
@@ -116,14 +116,28 @@ namespace WalletWasabi.Gui.ViewModels
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(_ =>
{
- if (Global?.WalletService?.LastProcessedFilter?.Header?.Height is uint lastProcessedFilterHeight
- && Global?.BitcoinStore?.SmartHeaderChain?.TipHeight is uint tipHeight)
+ var global = Global;
+ var walletService = global?.WalletService;
+ if (walletService is { })
+ {
+ if (walletService.LastProcessedFilter?.Header?.Height is uint lastProcessedFilterHeight
+ && global?.BitcoinStore?.SmartHeaderChain?.TipHeight is uint tipHeight)
{
var perc = tipHeight == 0 ?
100
: ((decimal)lastProcessedFilterHeight / tipHeight * 100);
TryAddStatus(StatusType.WalletProcessingFilters, (ushort)perc);
}
+
+ var txProcessor = walletService.TransactionProcessor;
+ if (txProcessor is { })
+ {
+ var perc = txProcessor.QueuedTxCount == 0 ?
+ 100
+ : ((decimal)txProcessor.QueuedProcessedTxCount / txProcessor.QueuedTxCount * 100);
+ TryAddStatus(StatusType.WalletProcessingTransactions, (ushort)perc);
+ }
+ }
}).DisposeWith(Disposables);
}
}

MODIFY
WalletWasabi/Blockchain/TransactionProcessing/TransactionProcessor.cs
WalletWasabi/Blockchain/TransactionProcessing/TransactionProcessor.cs
@@ -22,6 +22,13 @@ namespace WalletWasabi.Blockchain.TransactionProcessing
public event EventHandler<ProcessedResult> WalletRelevantTransactionProcessed;
+ #region Progress
+
+ public int QueuedTxCount { get; private set; }
+ public int QueuedProcessedTxCount { get; private set; }
+
+ #endregion Progress
+
public TransactionProcessor(
AllTransactionStore transactionStore,
KeyManager keyManager,
@@ -40,9 +47,19 @@ namespace WalletWasabi.Blockchain.TransactionProcessing
lock (Lock)
{
+ try
+ {
+ QueuedTxCount = txs.Count();
foreach (var tx in txs)
{
rets.Add(ProcessNoLock(tx));
+ QueuedProcessedTxCount++;
+ }
+ }
+ finally
+ {
+ QueuedTxCount = 0;
+ QueuedProcessedTxCount = 0;
}
}
@@ -59,8 +76,16 @@ namespace WalletWasabi.Blockchain.TransactionProcessing
ProcessedResult ret;
lock (Lock)
{
+ try
+ {
+ QueuedTxCount = 1;
ret = ProcessNoLock(tx);
}
+ finally
+ {
+ QueuedTxCount = 0;
+ }
+ }
if (ret.IsNews)
{
WalletRelevantTransactionProcessed?.Invoke(this, ret);

Implement transaction processing percentage feedback