Fix bug: "some phases are not shown".
MODIFY
HiddenWallet.Daemon/Wrappers/WalletWrapper.cs
HiddenWallet.Daemon/Wrappers/WalletWrapper.cs
@@ -96,7 +96,7 @@ namespace HiddenWallet.Daemon.Wrappers
WalletJob.HeaderHeightChanged += WalletJob_HeaderHeightChangedAsync;
(await WalletJob.GetTrackerAsync()).BestHeightChanged += WalletWrapper_BestHeightChangedAsync;
WalletJob.ConnectedNodeCountChanged += WalletJob_ConnectedNodeCountChangedAsync;
- WalletJob.CoinJoinService.PeerCountChanged += CoinJoinService_PeerCountChangedAsync;
+ WalletJob.CoinJoinService.ParametersChanged += CoinJoinService_ParametersChangedAsync;
(await WalletJob.GetTrackerAsync()).TrackedTransactions.CollectionChanged += TrackedTransactions_CollectionChangedAsync;
@@ -111,6 +111,12 @@ namespace HiddenWallet.Daemon.Wrappers
}
}
+ private async void CoinJoinService_ParametersChangedAsync(object sender, (int PeerCount, ChaumianCoinJoin.TumblerPhase Phase) e)
+ {
+ TumblerStatusResponse status = GetTumblerStatusResponse();
+ await NotificationBroadcaster.Instance.BroadcastTumblerStatusAsync(status);
+ }
+
private async Task InitializeCoinJoinServiceAsync(Network network)
{
string rsaPath;
@@ -176,12 +182,6 @@ namespace HiddenWallet.Daemon.Wrappers
await NotificationBroadcaster.Instance.BroadcastMempoolAsync(e.MempoolTxCount.ToString());
}
- private async void CoinJoinService_PeerCountChangedAsync(object sender, int peerCount)
- {
- TumblerStatusResponse status = GetTumblerStatusResponse();
- await NotificationBroadcaster.Instance.BroadcastTumblerStatusAsync(status);
- }
-
public async Task RecoverAsync(string password, string mnemonic, string creationTime)
{
await Safe.RecoverAsync(
@@ -300,7 +300,7 @@ namespace HiddenWallet.Daemon.Wrappers
WalletJob.HeaderHeightChanged -= WalletJob_HeaderHeightChangedAsync;
(await WalletJob.GetTrackerAsync()).BestHeightChanged -= WalletWrapper_BestHeightChangedAsync;
WalletJob.ConnectedNodeCountChanged -= WalletJob_ConnectedNodeCountChangedAsync;
- WalletJob.CoinJoinService.PeerCountChanged -= CoinJoinService_PeerCountChangedAsync;
+ WalletJob.CoinJoinService.ParametersChanged -= CoinJoinService_ParametersChangedAsync;
(await WalletJob.GetTrackerAsync()).TrackedTransactions.CollectionChanged -= TrackedTransactions_CollectionChangedAsync;
}

MODIFY
HiddenWallet.FullSpvWallet/ChaumianCoinJoin/CoinJoinService.cs
HiddenWallet.FullSpvWallet/ChaumianCoinJoin/CoinJoinService.cs
@@ -35,7 +35,22 @@ namespace HiddenWallet.FullSpvWallet.ChaumianCoinJoin
public BlindingRsaPubKey PubKey { get; private set; }
public volatile bool TumblingInProcess;
- public volatile TumblerPhase Phase;
+ private volatile TumblerPhase _phase;
+ public TumblerPhase Phase
+ {
+ get
+ {
+ return _phase;
+ }
+ set
+ {
+ if (value != _phase)
+ {
+ _phase = value;
+ OnParametersChanged(PeerCount, value);
+ }
+ }
+ }
public volatile Exception TumblingException;
public volatile bool CompletedLastPhase;
public volatile Transaction CoinJoin;
@@ -56,12 +71,12 @@ namespace HiddenWallet.FullSpvWallet.ChaumianCoinJoin
if (value != _peerCount)
{
_peerCount = value;
- OnPeerCountChanged(value);
+ OnParametersChanged(value, Phase);
}
}
}
- public event EventHandler<int> PeerCountChanged;
- public void OnPeerCountChanged(int peerCount) => PeerCountChanged?.Invoke(this, peerCount);
+ public event EventHandler<(int PeerCount, TumblerPhase Phase)> ParametersChanged;
+ public void OnParametersChanged(int peerCount, TumblerPhase phase) => ParametersChanged?.Invoke(this, (peerCount, phase));
public string UniqueAliceId { get; private set; }
public BitcoinWitPubKeyAddress ActiveOutput { get; private set; }

Fix bug: "some phases are not shown".