clean up Inmate and Prison
MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/UtxoPrisonTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/UtxoPrisonTests.cs
@@ -104,7 +104,7 @@ public class UtxoPrisonTests
var utxo = BitcoinFactory.CreateOutPoint();
var past = DateTimeOffset.UtcNow - TimeSpan.FromDays(40);
- p.Punish(new Inmate(utxo, Punishment.Banned, past, id1, IsLongBan: true));
+ p.Punish(new Inmate(utxo, Punishment.LongBanned, past, id1));
Assert.Single(p.GetInmates());

MODIFY
WalletWasabi/WabiSabi/Backend/Banning/Inmate.cs
WalletWasabi/WabiSabi/Backend/Banning/Inmate.cs
@@ -9,8 +9,7 @@ public record Inmate(
OutPoint Utxo,
Punishment Punishment,
DateTimeOffset Started,
- uint256 LastDisruptedRoundId,
- bool IsLongBan = false)
+ uint256 LastDisruptedRoundId)
{
public TimeSpan TimeSpent => DateTimeOffset.UtcNow - Started;
@@ -23,20 +22,15 @@ public record Inmate(
var utxoHashString = parts[2];
var utxoIndexString = parts[3];
var disruptedRoundIdString = parts[4];
- var isLongBan = false;
- if (parts.Length > 5)
- {
- isLongBan = bool.Parse(parts[5]);
- }
var started = DateTimeOffset.FromUnixTimeSeconds(long.Parse(startedString));
var punishment = Enum.Parse<Punishment>(punishmentString);
var utxo = new OutPoint(new uint256(utxoHashString), int.Parse(utxoIndexString));
var lastDisruptedRoundId = uint256.Parse(disruptedRoundIdString);
- return new(utxo, punishment, started, lastDisruptedRoundId, isLongBan);
+ return new(utxo, punishment, started, lastDisruptedRoundId);
}
public override string ToString()
- => $"{Started.ToUnixTimeSeconds()}:{Punishment}:{Utxo.Hash}:{Utxo.N}:{LastDisruptedRoundId}:{IsLongBan}";
+ => $"{Started.ToUnixTimeSeconds()}:{Punishment}:{Utxo.Hash}:{Utxo.N}:{LastDisruptedRoundId}";
}

MODIFY
WalletWasabi/WabiSabi/Backend/Banning/Prison.cs
WalletWasabi/WabiSabi/Backend/Banning/Prison.cs
@@ -100,7 +100,7 @@ public class Prison
foreach (var inmate in Inmates.Values.ToList())
{
- var banPeriod = inmate.IsLongBan ? longBanPeriod : normalBanPeriod;
+ var banPeriod = inmate.Punishment is Punishment.LongBanned ? longBanPeriod : normalBanPeriod;
if (inmate.TimeSpent > banPeriod)
{
Inmates.Remove(inmate.Utxo);

clean up Inmate and Prison