Fill out status
MODIFY
WalletWasabi.Gui/Controls/StatusBar.xaml
WalletWasabi.Gui/Controls/StatusBar.xaml
<StackPanel Orientation="Horizontal" Gap="4" DockPanel.Dock="Right">
<TextBlock>Connections: </TextBlock>
<TextBlock Text="{Binding Connections}" />
- <TextBlock>Filters Left: </TextBlock>
- <TextBlock Text="1" />
+ <TextBlock>Filters: </TextBlock>
+ <TextBlock Text="{Binding Filters}" />
<TextBlock>Blocks Left: </TextBlock>
- <TextBlock Text="1" />
+ <TextBlock Text="{Binding BlocksLeft}" />
<TextBlock>Mempool: </TextBlock>
- <TextBlock Text="1" />
+ <TextBlock Text="{Binding Mempool}" />
</StackPanel>
<TextBlock>Ready</TextBlock>
</DockPanel>

MODIFY
WalletWasabi.Gui/Program.cs
WalletWasabi.Gui/Program.cs
@@ -32,7 +32,7 @@ namespace WalletWasabi.Gui
Logger.LogInfo<Config>("Config is successfully initialized.");
Global.Initialize(config);
- statusBar = new StatusBarViewModel(Global.Nodes.ConnectedNodes);
+ statusBar = new StatusBarViewModel(Global.Nodes.ConnectedNodes, Global.MemPoolService, Global.IndexDownloader);
BuildAvaloniaApp()
.StartShellApp<AppBuilder, MainWindow>("Wasabi Wallet", new DefaultLayoutFactory(), () => new MainWindowViewModel(statusBar));

MODIFY
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
WalletWasabi.Gui/ViewModels/StatusBarViewModel.cs
@@ -3,12 +3,15 @@ using System.Collections.Generic;
using System.Text;
using NBitcoin.Protocol;
using ReactiveUI;
+using WalletWasabi.Services;
namespace WalletWasabi.Gui.ViewModels
{
public class StatusBarViewModel : ViewModelBase, IDisposable
{
- private NodesCollection Nodes { get; }
+ public NodesCollection Nodes { get; }
+ public MemPoolService MemPoolService { get; }
+ public IndexDownloader IndexDownloader { get; }
private int _connections;
@@ -21,14 +24,14 @@ namespace WalletWasabi.Gui.ViewModels
}
}
- private int _filtersLeft;
+ private int _filters;
- public int FiltersLeft
+ public int Filters
{
- get { return _filtersLeft; }
+ get { return _filters; }
set
{
- this.RaiseAndSetIfChanged(ref _filtersLeft, value);
+ this.RaiseAndSetIfChanged(ref _filters, value);
}
}
@@ -43,6 +46,17 @@ namespace WalletWasabi.Gui.ViewModels
}
}
+ private int _mempool;
+
+ public int Mempool
+ {
+ get { return _mempool; }
+ set
+ {
+ this.RaiseAndSetIfChanged(ref _mempool, value);
+ }
+ }
+
private string _status;
public string Status
@@ -51,11 +65,30 @@ namespace WalletWasabi.Gui.ViewModels
set { this.RaiseAndSetIfChanged(ref _status, value); }
}
- public StatusBarViewModel(NodesCollection nodes)
+ public StatusBarViewModel(NodesCollection nodes, MemPoolService memPoolService, IndexDownloader indexDownloader)
{
Nodes = nodes;
Nodes.Added += Nodes_Added;
Nodes.Removed += Nodes_Removed;
+ Connections = Nodes.Count;
+
+ MemPoolService = memPoolService;
+ MemPoolService.TransactionReceived += MemPoolService_TransactionReceived;
+ Mempool = MemPoolService.TransactionHashes.Count;
+
+ IndexDownloader = indexDownloader;
+ IndexDownloader.NewFilter += IndexDownloader_NewFilter;
+ Filters = IndexDownloader.GetBestHeight().Value;
+ }
+
+ private void IndexDownloader_NewFilter(object sender, Backend.Models.FilterModel e)
+ {
+ Filters = IndexDownloader.GetBestHeight().Value;
+ }
+
+ private void MemPoolService_TransactionReceived(object sender, Models.SmartTransaction e)
+ {
+ Mempool = MemPoolService.TransactionHashes.Count;
}
private void Nodes_Removed(object sender, NodeEventArgs e)
@@ -80,6 +113,8 @@ namespace WalletWasabi.Gui.ViewModels
{
Nodes.Added -= Nodes_Added;
Nodes.Removed -= Nodes_Removed;
+ MemPoolService.TransactionReceived -= MemPoolService_TransactionReceived;
+ IndexDownloader.NewFilter -= IndexDownloader_NewFilter;
}
_disposedValue = true;

MODIFY
WalletWasabi/Services/IndexDownloader.cs
WalletWasabi/Services/IndexDownloader.cs
@@ -232,6 +232,14 @@ namespace WalletWasabi.Services
}
}
+ public Height GetBestHeight()
+ {
+ using (IndexLock.Lock())
+ {
+ return Index.Last().BlockHeight;
+ }
+ }
+
public IEnumerable<FilterModel> GetFiltersIncluding(uint256 blockHash)
{
using (IndexLock.Lock())

Fill out status