Make sure spentcoins are frequently checked and removed.
MODIFY
WalletWasabi.Tests/RegTests.cs
WalletWasabi.Tests/RegTests.cs
@@ -2327,6 +2327,11 @@ namespace WalletWasabi.Tests
}
await Task.Delay(1000);
}
+
+ var cj = (await rpc.GetRawMempoolAsync()).Single();
+ smartCoin1.SpenderTransactionId = cj;
+ smartCoin2.SpenderTransactionId = cj;
+ smartCoin3.SpenderTransactionId = cj;
}
finally
{

MODIFY
WalletWasabi/Services/CcjClient.cs
WalletWasabi/Services/CcjClient.cs
@@ -89,6 +89,8 @@ namespace WalletWasabi.Services
int delay;
using (await MixLock.LockAsync())
{
+ State.RemoveSpentCoinsFromWaitingList();
+
// If stop was requested return.
if (IsRunning == false) return;
@@ -141,6 +143,8 @@ namespace WalletWasabi.Services
int delay;
using (await MixLock.LockAsync())
{
+ State.RemoveSpentCoinsFromWaitingList();
+
states = await SatoshiClient.GetAllRoundStatesAsync();
State.UpdateRoundsByStates(states.ToArray());
delay = new Random().Next(0, 7); // delay the response to defend timing attack privacy
@@ -150,7 +154,7 @@ namespace WalletWasabi.Services
using (await MixLock.LockAsync())
{
- State.RemoveSpentCoinsFromWaitingList(); // Make sure coins those were somehow spent are removed.
+ State.RemoveSpentCoinsFromWaitingList();
CcjClientRound inputRegistrableRound = State.GetRegistrableRoundOrDefault();
if (inputRegistrableRound != null)
@@ -360,6 +364,8 @@ namespace WalletWasabi.Services
{
using (MixLock.Lock())
{
+ State.RemoveSpentCoinsFromWaitingList();
+
var successful = new List<SmartCoin>();
foreach (SmartCoin coin in coins)
@@ -390,6 +396,14 @@ namespace WalletWasabi.Services
public async Task DequeueCoinsFromMixAsync(params SmartCoin[] coins)
{
using (await MixLock.LockAsync())
+ {
+ State.RemoveSpentCoinsFromWaitingList();
+
+ await DequeueCoinsFromMixNoLockAsync(coins);
+ }
+ }
+
+ private async Task DequeueCoinsFromMixNoLockAsync(params SmartCoin[] coins)
{
List<Exception> exceptions = new List<Exception>();
@@ -443,7 +457,6 @@ namespace WalletWasabi.Services
throw new AggregateException(exceptions);
}
}
- }
public async Task StopAsync()
{
@@ -461,6 +474,8 @@ namespace WalletWasabi.Services
using (await MixLock.LockAsync())
{
+ State.RemoveSpentCoinsFromWaitingList();
+
SatoshiClient?.Dispose();
State.DisposeAllAliceClients();
@@ -474,7 +489,7 @@ namespace WalletWasabi.Services
{
continue; // The coin isn't present anymore. Good. This should never happen though.
}
- await DequeueCoinsFromMixAsync(coin);
+ await DequeueCoinsFromMixNoLockAsync(coin);
}
catch (Exception ex)
{

Make sure spentcoins are frequently checked and removed.