Make `RoundState` to compute round hash
MODIFY
WalletWasabi/WabiSabi/Backend/Rounds/Round.cs
WalletWasabi/WabiSabi/Backend/Rounds/Round.cs
@@ -12,6 +12,7 @@ namespace WalletWasabi.WabiSabi.Backend.Rounds
{
public class Round
{
+ private uint256 _id;
public Round(RoundParameters roundParameters)
{
RoundParameters = roundParameters;
@@ -28,12 +29,10 @@ namespace WalletWasabi.WabiSabi.Backend.Rounds
VsizeCredentialIssuer = new(new(RoundParameters.Random), RoundParameters.Random, MaxRegistrableVsize);
AmountCredentialIssuerParameters = AmountCredentialIssuer.CredentialIssuerSecretKey.ComputeCredentialIssuerParameters();
VsizeCredentialIssuerParameters = VsizeCredentialIssuer.CredentialIssuerSecretKey.ComputeCredentialIssuerParameters();
-
- Id = CalculateHash();
}
+ public uint256 Id => _id ??= CalculateHash();
public MultipartyTransactionState CoinjoinState { get; set; }
- public uint256 Id { get; }
public Network Network => RoundParameters.Network;
public Money MinRegistrableAmount => RoundParameters.MinRegistrableAmount;
public Money MaxRegistrableAmount => RoundParameters.MaxRegistrableAmount;

MODIFY
WalletWasabi/WabiSabi/Models/RoundState.cs
WalletWasabi/WabiSabi/Models/RoundState.cs
@@ -9,29 +9,39 @@ using WalletWasabi.WabiSabi.Models.MultipartyTransaction;
namespace WalletWasabi.WabiSabi.Models
{
public record RoundState(
- uint256 Id,
uint256? BlameOf,
CredentialIssuerParameters AmountCredentialIssuerParameters,
CredentialIssuerParameters VsizeCredentialIssuerParameters,
FeeRate FeeRate,
Phase Phase,
bool WasTransactionBroadcast,
+ TimeSpan InputRegistrationTimeout,
TimeSpan ConnectionConfirmationTimeout,
+ TimeSpan OutputRegistrationTimeout,
+ TimeSpan TransactionSigningTimeout,
+ long MinRegistrableAmount,
long MaxRegistrableAmount,
long MaxRegistrableVsize,
long MaxVsizeAllocationPerAlice,
MultipartyTransactionState CoinjoinState)
{
+ private uint256 _id;
+
+ public uint256 Id => _id ??= CalculateHash();
+
public static RoundState FromRound(Round round) =>
new(
- round.Id,
round.BlameOf?.Id,
round.AmountCredentialIssuerParameters,
round.VsizeCredentialIssuerParameters,
round.FeeRate,
round.Phase,
round.WasTransactionBroadcast,
+ round.InputRegistrationTimeout,
round.ConnectionConfirmationTimeout,
+ round.OutputRegistrationTimeout,
+ round.TransactionSigningTimeout,
+ round.MinRegistrableAmount,
round.MaxRegistrableAmount,
round.MaxRegistrableVsize,
round.MaxVsizeAllocationPerAlice,
@@ -49,5 +59,19 @@ namespace WalletWasabi.WabiSabi.Models
public WabiSabiClient CreateVsizeCredentialClient(WasabiRandom random) =>
new(VsizeCredentialIssuerParameters, random, MaxRegistrableVsize);
+
+ private uint256 CalculateHash() =>
+ RoundHasher.CalculateHash(
+ InputRegistrationTimeout,
+ ConnectionConfirmationTimeout,
+ OutputRegistrationTimeout,
+ TransactionSigningTimeout,
+ MinRegistrableAmount,
+ MaxRegistrableAmount,
+ MaxRegistrableVsize,
+ MaxVsizeAllocationPerAlice,
+ AmountCredentialIssuerParameters,
+ VsizeCredentialIssuerParameters,
+ FeeRate.FeePerK);
}
}

Make `RoundState` to compute round hash