fix bobs in multiple rounds
MODIFY
WalletWasabi.Tests/UnitTests/TestWallet.cs
WalletWasabi.Tests/UnitTests/TestWallet.cs
@@ -141,7 +141,7 @@ public class TestWallet : IKeyChain, IDestinationProvider
}
public IEnumerable<IDestination> GetNextDestinations(int count) =>
- Enumerable.Repeat(CreateNewAddress(), count);
+ Enumerable.Range(0, count).Select(_ => CreateNewAddress());
private void ScanTransaction(Transaction tx)
{

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Arena.Partial.cs
WalletWasabi/WabiSabi/Backend/Rounds/Arena.Partial.cs
@@ -259,11 +259,18 @@ public partial class Arena : IWabiSabiApiRequestHandler
throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.AlreadyRegisteredScript, $"Round ({request.RoundId}): Already registered script.");
}
- var inputScripts = round.Alices.Select(a => a.Coin.ScriptPubKey).ToHashSet();
+ var outputScripts = Rounds.Where(r => r.Phase != Phase.Ended).SelectMany(r => r.Bobs).Select(x => x.Script).ToHashSet();
+ if (outputScripts.Contains(request.Script))
+ {
+ Logger.LogWarning($"Round ({request.RoundId}): Already registered script in some round.");
+ throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.AlreadyRegisteredScript, $"Round ({request.RoundId}): Already registered script in some round.");
+ }
+
+ var inputScripts = Rounds.SelectMany(r => round.Alices).Select(a => a.Coin.ScriptPubKey).ToHashSet();
if (inputScripts.Contains(request.Script))
{
- Logger.LogWarning($"Round ({request.RoundId}): Already registered script in the round.");
- throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.AlreadyRegisteredScript, $"Round ({request.RoundId}): Already registered script in round.");
+ Logger.LogWarning($"Round ({request.RoundId}): Already registered script in some round.");
+ throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.AlreadyRegisteredScript, $"Round ({request.RoundId}): Already registered script some round.");
}
Bob bob = new(request.Script, credentialAmount);

fix bobs in multiple rounds