Small refactoring for centralizing feedback
MODIFY
WalletWasabi/Services/CcjClient.cs
WalletWasabi/Services/CcjClient.cs
@@ -141,7 +141,7 @@ namespace WalletWasabi.Services
{
using (await MixLock.LockAsync())
{
- await DequeueCoinsFromMixNoLockAsync(State.GetSpentCoins().ToArray());
+ await DequeueSpentCoinsFromMixNoLockAsync();
// If stop was requested return.
if (IsRunning == false)
@@ -218,7 +218,7 @@ namespace WalletWasabi.Services
DelayedRoundRegistration = null; // Don't dispose.
}
- await DequeueCoinsFromMixNoLockAsync(State.GetSpentCoins().ToArray());
+ await DequeueSpentCoinsFromMixNoLockAsync();
State.UpdateRoundsByStates(ExposedLinks, states.ToArray());
@@ -258,7 +258,7 @@ namespace WalletWasabi.Services
await TryProcessRoundStateAsync(ongoingRoundId);
}
- await DequeueCoinsFromMixNoLockAsync(State.GetSpentCoins().ToArray());
+ await DequeueSpentCoinsFromMixNoLockAsync();
CcjClientRound inputRegistrableRound = State.GetRegistrableRoundOrDefault();
if (inputRegistrableRound != null)
{
@@ -763,7 +763,7 @@ namespace WalletWasabi.Services
var successful = new List<SmartCoin>();
using (await MixLock.LockAsync())
{
- await DequeueCoinsFromMixNoLockAsync(State.GetSpentCoins().ToArray());
+ await DequeueSpentCoinsFromMixNoLockAsync();
// Every time the user enqueues (intentionally writes in password) then the coordinator fee percent must be noted and dequeue later if changes.
CcjClientRound latestRound = State.GetLatestRoundOrDefault();
@@ -824,7 +824,7 @@ namespace WalletWasabi.Services
{
using (await MixLock.LockAsync(cts.Token))
{
- await DequeueCoinsFromMixNoLockAsync(State.GetSpentCoins().ToArray());
+ await DequeueSpentCoinsFromMixNoLockAsync();
await DequeueCoinsFromMixNoLockAsync(coins.Select(x => x.GetTxoRef()).ToArray());
}
@@ -882,14 +882,14 @@ namespace WalletWasabi.Services
{
using (await MixLock.LockAsync(cts.Token))
{
- await DequeueCoinsFromMixNoLockAsync(State.GetSpentCoins().ToArray());
+ await DequeueSpentCoinsFromMixNoLockAsync();
await DequeueCoinsFromMixNoLockAsync(coins);
}
}
catch (TaskCanceledException)
{
- await DequeueCoinsFromMixNoLockAsync(State.GetSpentCoins().ToArray());
+ await DequeueSpentCoinsFromMixNoLockAsync();
await DequeueCoinsFromMixNoLockAsync(coins);
}
@@ -904,12 +904,12 @@ namespace WalletWasabi.Services
{
using (await MixLock.LockAsync(cts.Token))
{
- await DequeueCoinsFromMixNoLockAsync(State.GetAllQueuedCoins().ToArray());
+ await DequeueAllCoinsFromMixNoLockAsync();
}
}
catch (TaskCanceledException)
{
- await DequeueCoinsFromMixNoLockAsync(State.GetAllQueuedCoins().ToArray());
+ await DequeueAllCoinsFromMixNoLockAsync();
}
}
}
@@ -919,6 +919,11 @@ namespace WalletWasabi.Services
await DequeueCoinsFromMixNoLockAsync(State.GetAllQueuedCoins().ToArray());
}
+ private async Task DequeueSpentCoinsFromMixNoLockAsync()
+ {
+ await DequeueCoinsFromMixNoLockAsync(State.GetSpentCoins().ToArray());
+ }
+
private async Task DequeueCoinsFromMixNoLockAsync(params TxoRef[] coins)
{
if (coins is null || !coins.Any())
@@ -1037,7 +1042,7 @@ namespace WalletWasabi.Services
using (await MixLock.LockAsync())
{
- await DequeueCoinsFromMixNoLockAsync(State.GetSpentCoins().ToArray());
+ await DequeueSpentCoinsFromMixNoLockAsync();
State.DisposeAllAliceClients();

Small refactoring for centralizing feedback