send exception data from backend
MODIFY
WalletWasabi.Backend/Filters/ExceptionTranslateFilter.cs
WalletWasabi.Backend/Filters/ExceptionTranslateFilter.cs
using System.Net;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
+using Newtonsoft.Json;
using WalletWasabi.WabiSabi;
using WalletWasabi.WabiSabi.Backend.Models;
using WalletWasabi.WabiSabi.Crypto;
@@ -19,14 +20,16 @@ public class ExceptionTranslateAttribute : ExceptionFilterAttribute
WabiSabiProtocolException e => new JsonResult(new Error(
Type: ProtocolConstants.ProtocolViolationType,
ErrorCode: e.ErrorCode.ToString(),
- Description: e.Message))
+ Description: e.Message,
+ Data: JsonConvert.SerializeObject(e.ExceptionData, Formatting.None)))
{
StatusCode = (int)HttpStatusCode.InternalServerError
},
WabiSabiCryptoException e => new JsonResult(new Error(
Type: ProtocolConstants.ProtocolViolationType,
ErrorCode: WabiSabiProtocolErrorCode.CryptoException.ToString(),
- Description: e.Message))
+ Description: e.Message,
+ Data: string.Empty))
{
StatusCode = (int)HttpStatusCode.InternalServerError
},

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Arena.Partial.cs
WalletWasabi/WabiSabi/Backend/Rounds/Arena.Partial.cs
@@ -358,14 +358,16 @@ public partial class Arena : IWabiSabiApiRequestHandler
if (Prison.TryGet(input, out var inmate))
{
+ DateTimeOffset bannedUntil;
if (inmate.Punishment == Punishment.LongBanned)
{
- throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputLongBanned, $"{Config.ReleaseUtxoFromPrisonAfterLongBan - inmate.TimeSpent}");
+ bannedUntil = inmate.Started + Config.ReleaseUtxoFromPrisonAfterLongBan;
+ throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputLongBanned, exceptionData: new InputBannedExceptionData(bannedUntil.ToUnixTimeSeconds()));
}
-
- if (!Config.AllowNotedInputRegistration || inmate.Punishment != Punishment.Noted)
+ else if (!Config.AllowNotedInputRegistration || inmate.Punishment != Punishment.Noted)
{
- throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputBanned, $"{Config.ReleaseUtxoFromPrisonAfter - inmate.TimeSpent}");
+ bannedUntil = inmate.Started + Config.ReleaseUtxoFromPrisonAfter;
+ throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputBanned, exceptionData: new InputBannedExceptionData(bannedUntil.ToUnixTimeSeconds()));
}
}

send exception data from backend