Move hash calculation to a better place
MODIFY
WalletWasabi/WabiSabi/Backend/Models/Alice.cs
WalletWasabi/WabiSabi/Backend/Models/Alice.cs
@@ -40,13 +40,5 @@ namespace WalletWasabi.WabiSabi.Backend.Models
.Append(ProtocolConstants.AliceCoinOutpointStrobeLabel, Coin.Outpoint)
.Append(ProtocolConstants.AliceOwnershipProofStrobeLabel, OwnershipProof)
.GetHash();
-
- public static uint256 CalculateHash(Coin coin, BitcoinSecret bitcoinSecret, uint256 roundId)
- {
- var ownershipProof = OwnershipProof.GenerateCoinJoinInputProof(
- bitcoinSecret.PrivateKey,
- new CoinJoinInputCommitmentData("CoinJoinCoordinatorIdentifier", roundId));
- return new Alice(coin, ownershipProof).CalculateHash();
- }
}
}

MODIFY
WalletWasabi/WabiSabi/Client/AliceClient.cs
WalletWasabi/WabiSabi/Client/AliceClient.cs
@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using WalletWasabi.Crypto;
using WalletWasabi.Helpers;
using WalletWasabi.Logging;
using WalletWasabi.WabiSabi.Backend.Models;
@@ -14,7 +15,7 @@ namespace WalletWasabi.WabiSabi.Client
{
public AliceClient(uint256 roundId, ArenaClient arenaClient, Coin coin, FeeRate feeRate, BitcoinSecret bitcoinSecret)
{
- AliceId = Alice.CalculateHash(coin, bitcoinSecret, roundId);
+ AliceId = CalculateHash(coin, bitcoinSecret, roundId);
RoundId = roundId;
ArenaClient = arenaClient;
Coin = coin;
@@ -84,5 +85,13 @@ namespace WalletWasabi.WabiSabi.Client
Logger.LogInfo($"Round ({RoundId}), Alice ({AliceId}): Posted a signature.");
}
+
+ private static uint256 CalculateHash(Coin coin, BitcoinSecret bitcoinSecret, uint256 roundId)
+ {
+ var ownershipProof = OwnershipProof.GenerateCoinJoinInputProof(
+ bitcoinSecret.PrivateKey,
+ new CoinJoinInputCommitmentData("CoinJoinCoordinatorIdentifier", roundId));
+ return new Alice(coin, ownershipProof).Id;
+ }
}
}

Move hash calculation to a better place