Add rescheduling
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/CoinVerifierTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/CoinVerifierTests.cs
@@ -227,7 +227,7 @@ public class CoinVerifierTests
{
foreach (Coin coin in coins)
{
- coinVerifier.ScheduleVerification(coin, CancellationToken.None);
+ coinVerifier.ScheduleVerification(coin, CancellationToken.None, confirmations: _wabisabiTestConfig.CoinVerifierRequiredConfirmation);
}
}
}

MODIFY
WalletWasabi/WabiSabi/Backend/Banning/CoinVerifier.cs
WalletWasabi/WabiSabi/Backend/Banning/CoinVerifier.cs
@@ -47,12 +47,20 @@ public class CoinVerifier
List<Task<CoinVerifyResult>> tasks = new();
foreach (var coin in coinsToCheck)
{
- if (CoinVerifyItems.TryGetValue(coin, out var item))
+ if (!CoinVerifyItems.TryGetValue(coin, out var item))
{
- tasks.Add(item.TaskCompletionSource.Task);
+ // Quickly re-scheduling the missing items.
+ ScheduleVerification(coin, cancellationToken, TimeSpan.Zero);
+ if (!CoinVerifyItems.TryGetValue(coin, out item))
+ {
+ // This should not happen.
+ Logger.LogError("Coin cannot be re-scheduled for verification.");
}
}
+ tasks.Add(item.TaskCompletionSource.Task);
+ }
+
try
{
do
@@ -150,11 +158,14 @@ public class CoinVerifier
return;
}
- if (confirmations is { } confs && coin.Amount > WabiSabiConfig.CoinVerifierRequiredConfirmationAmount && confs < WabiSabiConfig.CoinVerifierRequiredConfirmation)
+ if (coin.Amount >= WabiSabiConfig.CoinVerifierRequiredConfirmationAmount)
+ {
+ if (confirmations is null || confirmations < WabiSabiConfig.CoinVerifierRequiredConfirmation)
{
taskCompletionSource.SetResult(new CoinVerifyResult(coin, false, ShouldRemove: true));
return;
}
+ }
_ = Task.Run(async () =>
{

Add rescheduling