Introduce CoinJoinCommitmentData in Round
MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Arena.Partial.cs
WalletWasabi/WabiSabi/Backend/Rounds/Arena.Partial.cs
@@ -58,12 +58,10 @@ public partial class Arena : IWabiSabiApiRequestHandler
throw new WabiSabiProtocolException(WabiSabiProtocolErrorCode.InputNotWhitelisted);
}
- var coinJoinInputCommitmentData = new CoinJoinInputCommitmentData(Config.CoordinatorIdentifier, request.RoundId);
-
// Compute but don't commit updated coinjoin to round state, it will
// be re-calculated on input confirmation. This is computed in here
// for validation purposes.
- _ = round.Assert<ConstructionState>().AddInput(coin, request.OwnershipProof, coinJoinInputCommitmentData);
+ _ = round.Assert<ConstructionState>().AddInput(coin, request.OwnershipProof, round.CoinJoinInputCommitmentData);
// Generate a new GUID with the secure random source, to be sure
// that it is not guessable (Guid.NewGuid() documentation does
@@ -232,8 +230,7 @@ public partial class Arena : IWabiSabiApiRequestHandler
await vsizeRealCredentialTask.ConfigureAwait(false));
// Update the coinjoin state, adding the confirmed input.
- var coinJoinInputCommitmentData = new CoinJoinInputCommitmentData(Config.CoordinatorIdentifier, request.RoundId);
- round.CoinjoinState = round.Assert<ConstructionState>().AddInput(alice.Coin, alice.OwnershipProof, coinJoinInputCommitmentData);
+ round.CoinjoinState = round.Assert<ConstructionState>().AddInput(alice.Coin, alice.OwnershipProof, round.CoinJoinInputCommitmentData);
alice.ConfirmedConnection = true;
return response;

MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Round.cs
WalletWasabi/WabiSabi/Backend/Rounds/Round.cs
@@ -46,6 +46,7 @@ public class Round
TransactionSigningTimeFrame = TimeFrame.Create(Parameters.TransactionSigningTimeout);
Id = CalculateHash();
+ CoinJoinInputCommitmentData = new CoinJoinInputCommitmentData(Parameters.CoordinationIdentifier, Id);
}
public uint256 Id { get; }
@@ -71,6 +72,8 @@ public class Round
public RoundParameters Parameters { get; }
public Script CoordinatorScript { get; set; }
+ public CoinJoinInputCommitmentData CoinJoinInputCommitmentData { get; init; }
+
public TState Assert<TState>() where TState : MultipartyTransactionState =>
CoinjoinState switch
{

Introduce CoinJoinCommitmentData in Round