Skip to content

Commit

Permalink
Instead of RoundId we are showing the successful Rounds completed.
Browse files Browse the repository at this point in the history
  • Loading branch information
molnard committed Nov 14, 2018
1 parent 0beb4a6 commit 9c0f9b2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
Expand Up @@ -37,8 +37,8 @@ public class ChaumianCoinJoinController : Controller
/// <summary>
/// Satoshi gets various status information.
/// </summary>
/// <returns>List of CcjRunningRoundStatus (Phase, Denomination, RegisteredPeerCount, RequiredPeerCount, MaximumInputCountPerPeer, FeePerInputs, FeePerOutputs, CoordinatorFeePercent)</returns>
/// <response code="200">List of CcjRunningRoundStatus (Phase, Denomination, RegisteredPeerCount, RequiredPeerCount, MaximumInputCountPerPeer, FeePerInputs, FeePerOutputs, CoordinatorFeePercent)</response>
/// <returns>List of CcjRunningRoundStatus (Phase, Denomination, RegisteredPeerCount, RequiredPeerCount, MaximumInputCountPerPeer, FeePerInputs, FeePerOutputs, CoordinatorFeePercent, RoundId, SuccessfulRoundCount)</returns>
/// <response code="200">List of CcjRunningRoundStatus (Phase, Denomination, RegisteredPeerCount, RequiredPeerCount, MaximumInputCountPerPeer, FeePerInputs, FeePerOutputs, CoordinatorFeePercent, RoundId, SuccessfulRoundCount)</response>
[HttpGet("states")]
[ProducesResponseType(200)]
public IActionResult GetStates()
Expand All @@ -58,7 +58,8 @@ public IActionResult GetStates()
FeePerInputs = round.FeePerInputs,
FeePerOutputs = round.FeePerOutputs,
CoordinatorFeePercent = round.CoordinatorFeePercent,
RoundId = round.RoundId
RoundId = round.RoundId,
SuccessfulRoundCount = Coordinator.GetCoinJoinCount() // This is round independent, it is only here because of backward compatibility.
};

response.Add(state);
Expand Down
6 changes: 3 additions & 3 deletions WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabView.xaml
Expand Up @@ -51,8 +51,8 @@
</StackPanel>

<StackPanel Orientation="Horizontal" Spacing="4">
<TextBlock Text="Round ID:"></TextBlock>
<TextBlock Text="{Binding RoundId}"></TextBlock>
<TextBlock Text="Number of Successful Rounds:"></TextBlock>
<TextBlock Text="{Binding SuccessfulRoundCount}"></TextBlock>
</StackPanel>

<StackPanel Orientation="Horizontal" Spacing="4" Margin="0 12" >
Expand All @@ -70,7 +70,7 @@
</StackPanel>

<StackPanel Orientation="Horizontal" Spacing="4">
<TextBlock Text="Number Of Registered Peers:"></TextBlock>
<TextBlock Text="Number of Registered Peers:"></TextBlock>
<TextBlock Foreground="YellowGreen" Text="{Binding PeersRegistered}"></TextBlock>
<TextBlock Text="/"></TextBlock>
<TextBlock Text="{Binding PeersNeeded}"></TextBlock>
Expand Down
10 changes: 10 additions & 0 deletions WalletWasabi.Gui/Controls/WalletExplorer/CoinJoinTabViewModel.cs
Expand Up @@ -23,6 +23,7 @@ public class CoinJoinTabViewModel : WalletActionViewModel
private CoinListViewModel _availableCoinsList;
private CoinListViewModel _queuedCoinsList;
private long _roundId;
private int _successfulRoundCount;
private CcjRoundPhase _phase;
private Money _requiredBTC;
private string _coordinatorFeePercent;
Expand Down Expand Up @@ -82,13 +83,15 @@ public CoinJoinTabViewModel(WalletViewModel walletViewModel)
if (mostAdvancedRound != default)
{
RoundId = mostAdvancedRound.State.RoundId;
SuccessfulRoundCount = mostAdvancedRound.State.SuccessfulRoundCount;
Phase = mostAdvancedRound.State.Phase;
PeersRegistered = mostAdvancedRound.State.RegisteredPeerCount;
PeersNeeded = mostAdvancedRound.State.RequiredPeerCount;
}
else
{
RoundId = -1;
SuccessfulRoundCount = -1;
Phase = CcjRoundPhase.InputRegistration;
PeersRegistered = 0;
PeersNeeded = 100;
Expand Down Expand Up @@ -210,6 +213,7 @@ private void UpdateStates()
if (mostAdvancedRound != default)
{
RoundId = mostAdvancedRound.State.RoundId;
SuccessfulRoundCount = mostAdvancedRound.State.SuccessfulRoundCount;
Phase = mostAdvancedRound.State.Phase;
PeersRegistered = mostAdvancedRound.State.RegisteredPeerCount;
PeersNeeded = mostAdvancedRound.State.RequiredPeerCount;
Expand Down Expand Up @@ -288,6 +292,12 @@ public long RoundId
set { this.RaiseAndSetIfChanged(ref _roundId, value); }
}

public int SuccessfulRoundCount
{
get { return _successfulRoundCount; }
set { this.RaiseAndSetIfChanged(ref _successfulRoundCount, value); }
}

public CcjRoundPhase Phase
{
get { return _phase; }
Expand Down
Expand Up @@ -34,6 +34,11 @@ public class CcjRunningRoundState

public long RoundId { get; set; }

/// <summary>
/// This is round independent, it is only here because of backward compatibility.
/// </summary>
public int SuccessfulRoundCount { get; set; }

public static CcjRunningRoundState CloneExcept(CcjRunningRoundState state, long roundId, int registeredPeerCount)
{
return new CcjRunningRoundState
Expand All @@ -47,7 +52,8 @@ public static CcjRunningRoundState CloneExcept(CcjRunningRoundState state, long
FeePerOutputs = state.FeePerOutputs,
MaximumInputCountPerPeer = state.MaximumInputCountPerPeer,
RegistrationTimeout = state.RegistrationTimeout,
RoundId = roundId
RoundId = roundId,
SuccessfulRoundCount = state.SuccessfulRoundCount
};
}

Expand Down
5 changes: 5 additions & 0 deletions WalletWasabi/Services/CcjCoordinator.cs
Expand Up @@ -317,6 +317,11 @@ public bool ContainsCoinJoin(uint256 hash)
}
}

public int GetCoinJoinCount()
{
return CoinJoins.Count;
}

public async Task<bool> IsUnconfirmedCoinJoinLimitReachedAsync()
{
using (await CoinJoinsLock.LockAsync())
Expand Down

0 comments on commit 9c0f9b2

Please sign in to comment.