Add buffer times
MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs
WalletWasabi/WabiSabi/Backend/Rounds/Arena.cs
@@ -104,7 +104,7 @@ public partial class Arena : PeriodicRunner
if (round.InputCount < Config.MinInputCountByRound)
{
- if (!round.InputRegistrationTimeFrame.HasExpired)
+ if (!round.InputRegistrationTimeFrame.HasExpired(Phase.InputRegistration))
{
continue;
}
@@ -137,7 +137,7 @@ public partial class Arena : PeriodicRunner
{
round.SetPhase(Phase.OutputRegistration);
}
- else if (round.ConnectionConfirmationTimeFrame.HasExpired)
+ else if (round.ConnectionConfirmationTimeFrame.HasExpired(Phase.ConnectionConfirmation))
{
var alicesDidntConfirm = round.Alices.Where(x => !x.ConfirmedConnection).ToArray();
foreach (var alice in alicesDidntConfirm)
@@ -198,7 +198,7 @@ public partial class Arena : PeriodicRunner
{
var allReady = round.Alices.All(a => a.ReadyToSign);
- if (allReady || round.OutputRegistrationTimeFrame.HasExpired)
+ if (allReady || round.OutputRegistrationTimeFrame.HasExpired(Phase.OutputRegistration))
{
var coinjoin = round.Assert<ConstructionState>();
@@ -293,7 +293,7 @@ public partial class Arena : PeriodicRunner
CoinJoinScriptStore?.AddRange(coinjoin.Outputs.Select(x => x.ScriptPubKey));
CoinJoinBroadcast?.Invoke(this, coinjoin);
}
- else if (round.TransactionSigningTimeFrame.HasExpired)
+ else if (round.TransactionSigningTimeFrame.HasExpired(Phase.TransactionSigning))
{
round.LogWarning($"Signing phase failed with timed out after {round.TransactionSigningTimeFrame.Duration.TotalSeconds} seconds.");
await FailTransactionSigningPhaseAsync(round, cancellationToken).ConfigureAwait(false);

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Round.cs
WalletWasabi/WabiSabi/Backend/Rounds/Round.cs
@@ -118,7 +118,7 @@ public class Round
return true;
}
- return InputRegistrationTimeFrame.HasExpired;
+ return InputRegistrationTimeFrame.HasExpired(Phase.InputRegistration);
}
public ConstructionState AddInput(Coin coin)

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/TimeFrame.cs
WalletWasabi/WabiSabi/Backend/Rounds/TimeFrame.cs
@@ -15,6 +15,27 @@ public record TimeFrame
public DateTimeOffset StartTime { get; init; }
public TimeSpan Duration { get; init; }
public bool HasStarted => StartTime > DateTimeOffset.MinValue && StartTime < DateTimeOffset.UtcNow;
- public bool HasExpired => HasStarted && EndTime < DateTimeOffset.UtcNow;
+ public bool HasExpired(Phase phase)
+ {
+ TimeSpan bufferTime;
+ if (phase == Phase.InputRegistration)
+ {
+ bufferTime = TimeSpan.Zero;
+ }
+ else if (phase == Phase.ConnectionConfirmation)
+ {
+ bufferTime = TimeSpan.FromMinutes(1);
+ }
+ else if (phase == Phase.OutputRegistration)
+ {
+ bufferTime = TimeSpan.FromMinutes(3);
+ }
+ else //if (phase == Phase.TransactionSigning)
+ {
+ bufferTime = TimeSpan.FromMinutes(2);
+ }
+ return HasStarted && (EndTime + bufferTime) < DateTimeOffset.UtcNow;
+ }
+
public TimeFrame StartNow() => this with { StartTime = DateTimeOffset.UtcNow };
}

Add buffer times