Everything from David's PR
MODIFY
WalletWasabi/WabiSabi/Backend/Banning/Prison.cs
WalletWasabi/WabiSabi/Backend/Banning/Prison.cs
@@ -43,7 +43,7 @@ public class Prison
public void Ban(Alice alice, uint256 lastDisruptedRoundId, bool isLongBan = false)
{
- Punish(alice.Coin.Outpoint, Punishment.Banned, lastDisruptedRoundId, isLongBan);
+ Punish(alice.Coin.Outpoint, isLongBan ? Punishment.LongBanned : Punishment.Banned, lastDisruptedRoundId);
}
public void Ban(OutPoint outpoint, uint256 lastDisruptedRoundId)
@@ -51,8 +51,8 @@ public class Prison
Punish(outpoint, Punishment.Banned, lastDisruptedRoundId);
}
- public void Punish(OutPoint utxo, Punishment punishment, uint256 lastDisruptedRoundId, bool isLongBan = false)
- => Punish(new Inmate(utxo, punishment, DateTimeOffset.UtcNow, lastDisruptedRoundId, isLongBan));
+ public void Punish(OutPoint utxo, Punishment punishment, uint256 lastDisruptedRoundId)
+ => Punish(new Inmate(utxo, punishment, DateTimeOffset.UtcNow, lastDisruptedRoundId));
public void Punish(Inmate inmate)
{

MODIFY
WalletWasabi/WabiSabi/Backend/Banning/Punishment.cs
WalletWasabi/WabiSabi/Backend/Banning/Punishment.cs
@@ -3,5 +3,6 @@ namespace WalletWasabi.WabiSabi.Backend.Banning;
public enum Punishment
{
Noted,
- Banned
+ Banned,
+ LongBanned
}

MODIFY
WalletWasabi/WabiSabi/Backend/Models/WabiSabiProtocolErrorCode.cs
WalletWasabi/WabiSabi/Backend/Models/WabiSabiProtocolErrorCode.cs
@@ -34,7 +34,8 @@ public enum WabiSabiProtocolErrorCode
CryptoException,
AliceAlreadySignalled,
AliceAlreadyConfirmedConnection,
- AlreadyRegisteredScript
+ AlreadyRegisteredScript,
+ InputLongBanned
}
public static class WabiSabiProtocolErrorCodeExtension

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Arena.Partial.cs
WalletWasabi/WabiSabi/Backend/Rounds/Arena.Partial.cs
@@ -13,6 +13,7 @@ using WalletWasabi.WabiSabi.Models;
using WalletWasabi.WabiSabi.Models.MultipartyTransaction;
using WalletWasabi.Logging;
using WalletWasabi.Crypto.Randomness;
+using System;
namespace WalletWasabi.WabiSabi.Backend.Rounds;
@@ -355,9 +356,21 @@ public partial class Arena : IWabiSabiApiRequestHandler
{
OutPoint input = request.Input;
- if (Prison.TryGet(input, out var inmate) && (!Config.AllowNotedInputRegistration || inmate.Punishment != Punishment.Noted))
+ if (Prison.TryGet(input, out var inmate))
{
- throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputBanned);
+ var bannedUntil = inmate.Punishment == Punishment.LongBanned ? inmate.Started + Config.ReleaseUtxoFromPrisonAfterLongBan : inmate.Started + Config.ReleaseUtxoFromPrisonAfter;
+
+ var message = $"Input banned until: {bannedUntil}";
+
+ if (inmate.Punishment == Punishment.LongBanned)
+ {
+ throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputLongBanned, message);
+ }
+
+ if (!Config.AllowNotedInputRegistration || inmate.Punishment != Punishment.Noted)
+ {
+ throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputBanned, message);
+ }
}
var txOutResponse = await Rpc.GetTxOutAsync(input.Hash, (int)input.N, includeMempool: true, cancellationToken).ConfigureAwait(false);

Everything from David's PR