Skip to content
Permalink
Browse files

Instead of RoundId we are showing the successful Rounds completed.

  • Loading branch information...
molnard committed Nov 14, 2018
1 parent 0beb4a6 commit 9c0f9b24c1902efac613022d5d178e07a9598624
@@ -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()
@@ -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);
@@ -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" >
@@ -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>
@@ -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;
@@ -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;
@@ -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;
@@ -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; }
@@ -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
@@ -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
};
}

@@ -317,6 +317,11 @@ public bool ContainsCoinJoin(uint256 hash)
}
}

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

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

0 comments on commit 9c0f9b2

Please sign in to comment.
You can’t perform that action at this time.