simplify response + calculate time on client side
MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Arena.Partial.cs
WalletWasabi/WabiSabi/Backend/Rounds/Arena.Partial.cs
@@ -358,18 +358,14 @@ public partial class Arena : IWabiSabiApiRequestHandler
if (Prison.TryGet(input, out var inmate))
{
- var bannedUntil = inmate.Punishment == Punishment.LongBanned ? inmate.Started + Config.ReleaseUtxoFromPrisonAfterLongBan : inmate.Started + Config.ReleaseUtxoFromPrisonAfter;
-
- var message = $"Input banned until: {bannedUntil.ToUnixTimeSeconds()}";
-
if (inmate.Punishment == Punishment.LongBanned)
{
- throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputLongBanned, message);
+ throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputLongBanned, $"{Config.ReleaseUtxoFromPrisonAfterLongBan - inmate.TimeSpent}");
}
if (!Config.AllowNotedInputRegistration || inmate.Punishment != Punishment.Noted)
{
- throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputBanned, message);
+ throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputBanned, $"{Config.ReleaseUtxoFromPrisonAfter - inmate.TimeSpent}");
}
}

MODIFY
WalletWasabi/WabiSabi/Client/AliceClient.cs
WalletWasabi/WabiSabi/Client/AliceClient.cs
@@ -109,15 +109,17 @@ public class AliceClient
break;
case WabiSabiProtocolErrorCode.InputBanned:
- coin.BannedUntilUtc = DateTimeOffset.UtcNow.AddDays(1);
+ var remainingTimeAsString = wpe.Message;
+ var remaining = TimeSpan.Parse(remainingTimeAsString);
+ coin.BannedUntilUtc = DateTimeOffset.Now + remaining;
coin.SetIsBanned();
- Logger.LogInfo($"{coin.Coin.Outpoint} is banned.");
+ Logger.LogInfo($"{coin.Coin.Outpoint} is banned until {coin.BannedUntilUtc}.");
break;
case WabiSabiProtocolErrorCode.InputLongBanned:
- var split = wpe.Message.Split(" ");
- var bannedUntilUnixSeconds = long.Parse(split[^1]);
- coin.BannedUntilUtc = DateTimeOffset.FromUnixTimeSeconds(bannedUntilUnixSeconds);
+ remainingTimeAsString = wpe.Message;
+ remaining = TimeSpan.Parse(remainingTimeAsString);
+ coin.BannedUntilUtc = DateTimeOffset.Now + remaining;
coin.SetIsBanned();
Logger.LogInfo($"{coin.Coin.Outpoint} is long banned until {coin.BannedUntilUtc}.");
break;

simplify response + calculate time on client side