Better timing calculation
MODIFY
WalletWasabi.Backend/Controllers/ChaumianCoinJoinController.cs
WalletWasabi.Backend/Controllers/ChaumianCoinJoinController.cs
@@ -309,9 +309,7 @@ public class ChaumianCoinJoinController : ControllerBase
foreach (var coin in alice.Inputs)
{
- var delayUntilVerificationStart = round.InputRegistrationTimesout - DateTimeOffset.UtcNow - CoinVerifier?.WabiSabiConfig.CoinVerifierStartBefore ?? TimeSpan.FromMinutes(2);
-
- CoinVerifier?.ScheduleVerification(coin, CancellationToken.None, delayUntilVerificationStart, false, coinAndTxOutResponses[coin].Confirmations);
+ CoinVerifier?.ScheduleVerification(coin, round.InputRegistrationTimesout, CancellationToken.None, false, coinAndTxOutResponses[coin].Confirmations);
}
round.AddAlice(alice);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/CoinVerifierTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/CoinVerifierTests.cs
@@ -184,7 +184,8 @@ public class CoinVerifierTests
List<Coin> naughtyCoins = new();
CoinJoinIdStore coinJoinIdStore = new();
CoinVerifierApiClient apiClient = new("token", Network.Main, mockHttpClient.Object);
- CoinVerifier coinVerifier = new(coinJoinIdStore, apiClient, new Whitelist(), _wabisabiTestConfig);
+ Whitelist whitelist = new();
+ CoinVerifier coinVerifier = new(coinJoinIdStore, apiClient, whitelist, _wabisabiTestConfig);
List<Coin> generatedCoins = GenerateCoins(10);
@@ -198,7 +199,7 @@ public class CoinVerifierTests
}
Assert.Empty(naughtyCoins); // Empty, so we won't kick out anyone from the CJ round.
- Assert.Equal(10, coinVerifier.Whitelist.CountInnocents());
+ Assert.Equal(10, whitelist.CountInnocents());
}
private string GenerateDirtyJsonReport()

MODIFY
WalletWasabi/WabiSabi/Backend/Banning/CoinVerifier.cs
WalletWasabi/WabiSabi/Backend/Banning/CoinVerifier.cs
@@ -19,8 +19,8 @@ public class CoinVerifier
WabiSabiConfig = wabiSabiConfig;
}
- public Whitelist Whitelist { get; }
- public WabiSabiConfig WabiSabiConfig { get; }
+ private Whitelist Whitelist { get; }
+ private WabiSabiConfig WabiSabiConfig { get; }
private CoinJoinIdStore CoinJoinIdStore { get; }
private CoinVerifierApiClient CoinVerifierApiClient { get; }
private ConcurrentDictionary<Coin, (DateTimeOffset ScheduleTime, TaskCompletionSource<CoinVerifyResult> TaskCompletionSource)> CoinVerifyItems { get; } = new();
@@ -121,6 +121,13 @@ public class CoinVerifier
return shouldBan;
}
+ public void ScheduleVerification(Coin coin, DateTimeOffset inputRegistrationEndTime, CancellationToken cancellationToken, bool oneHop = false, int? confirmations = null)
+ {
+ var startTime = inputRegistrationEndTime - WabiSabiConfig.CoinVerifierStartBefore;
+ var delayUntilStart = startTime - DateTimeOffset.UtcNow;
+ ScheduleVerification(coin, cancellationToken, delayUntilStart, oneHop, confirmations);
+ }
+
public void ScheduleVerification(Coin coin, CancellationToken cancellationToken, TimeSpan? delayedStart = null, bool oneHop = false, int? confirmations = null)
{
TaskCompletionSource<CoinVerifyResult> taskCompletionSource = new();

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Arena.Partial.cs
WalletWasabi/WabiSabi/Backend/Rounds/Arena.Partial.cs
@@ -117,8 +117,7 @@ public partial class Arena : IWabiSabiApiRequestHandler
alice.SetDeadlineRelativeTo(round.ConnectionConfirmationTimeFrame.Duration);
round.Alices.Add(alice);
- var delayUntilVerificationStart = round.InputRegistrationTimeFrame.EndTime - DateTimeOffset.UtcNow - Config.CoinVerifierStartBefore;
- CoinVerifier?.ScheduleVerification(coin, cancellationToken, delayUntilVerificationStart, oneHop, confirmations);
+ CoinVerifier?.ScheduleVerification(coin, round.InputRegistrationTimeFrame.EndTime, cancellationToken, oneHop, confirmations);
return new(alice.Id,
commitAmountCredentialResponse,

Better timing calculation