Extend parameters of GenerateOwnershipProof by script type
MODIFY
WalletWasabi.Tests/Helpers/WabiSabiFactory.cs
WalletWasabi.Tests/Helpers/WabiSabiFactory.cs
@@ -53,7 +53,8 @@ public static class WabiSabiFactory
=> OwnershipProof.GenerateCoinJoinInputProof(
key,
GetOwnershipIdentifier(key.PubKey.GetScriptPubKey(ScriptPubKeyType.Segwit)),
- new CoinJoinInputCommitmentData(CoordinatorIdentifier, roundHash ?? BitcoinFactory.CreateUint256()));
+ new CoinJoinInputCommitmentData(CoordinatorIdentifier, roundHash ?? BitcoinFactory.CreateUint256()),
+ ScriptPubKeyType.Segwit);
public static OwnershipIdentifier GetOwnershipIdentifier(Script scriptPubKey)
{

MODIFY
WalletWasabi.Tests/UnitTests/TestWallet.cs
WalletWasabi.Tests/UnitTests/TestWallet.cs
@@ -120,7 +120,8 @@ public class TestWallet : IKeyChain, IDestinationProvider
return OwnershipProof.GenerateCoinJoinInputProof(
extKey.PrivateKey,
new OwnershipIdentifier(identificationKey, destination.ScriptPubKey),
- committedData);
+ committedData,
+ ScriptPubKeyType.Segwit);
}
/// <remarks>Test wallet assumes that the ownership proof is always correct.</remarks>

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputFailureTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputFailureTests.cs
@@ -330,7 +330,7 @@ public class RegisterInputFailureTests
[Fact]
public async Task WrongCoordinatorIdentifierInOwnershipProofAsync()
{
- await TestOwnershipProof((key, roundId) => OwnershipProof.GenerateCoinJoinInputProof(key, new OwnershipIdentifier(key, key.PubKey.GetScriptPubKey(ScriptPubKeyType.Segwit)), new CoinJoinInputCommitmentData("test", roundId)));
+ await TestOwnershipProof((key, roundId) => OwnershipProof.GenerateCoinJoinInputProof(key, new OwnershipIdentifier(key, key.PubKey.GetScriptPubKey(ScriptPubKeyType.Segwit)), new CoinJoinInputCommitmentData("test", roundId), ScriptPubKeyType.Segwit));
}
[Fact]

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputSuccessTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Backend/PostRequests/RegisterInputSuccessTests.cs
@@ -68,7 +68,7 @@ public class RegisterInputSuccessTests
roundState.CreateVsizeCredentialClient(random),
"test",
arena);
- var ownershipProof = OwnershipProof.GenerateCoinJoinInputProof(key, new OwnershipIdentifier(key, key.PubKey.GetScriptPubKey(ScriptPubKeyType.Segwit)), new CoinJoinInputCommitmentData("test", round.Id));
+ var ownershipProof = OwnershipProof.GenerateCoinJoinInputProof(key, new OwnershipIdentifier(key, key.PubKey.GetScriptPubKey(ScriptPubKeyType.Segwit)), new CoinJoinInputCommitmentData("test", round.Id), ScriptPubKeyType.Segwit);
var (resp, _) = await arenaClient.RegisterInputAsync(round.Id, coin.Outpoint, ownershipProof, CancellationToken.None);
AssertSingleAliceSuccessfullyRegistered(round, minAliceDeadline, resp);

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Crypto/OwnershipProofTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Crypto/OwnershipProofTests.cs
@@ -39,5 +39,6 @@ public class OwnershipProofTests
=> OwnershipProof.GenerateCoinJoinInputProof(
key,
new OwnershipIdentifier(key, key.PubKey.GetScriptPubKey(ScriptPubKeyType.Segwit)),
- new CoinJoinInputCommitmentData("wasabiwallet.io", roundHash));
+ new CoinJoinInputCommitmentData("wasabiwallet.io", roundHash),
+ ScriptPubKeyType.Segwit);
}

MODIFY
WalletWasabi.Tests/UnitTests/WabiSabi/Models/InputRegistrationRequestTests.cs
WalletWasabi.Tests/UnitTests/WabiSabi/Models/InputRegistrationRequestTests.cs
@@ -123,5 +123,6 @@ public class InputRegistrationRequestTests
=> OwnershipProof.GenerateCoinJoinInputProof(
key,
new OwnershipIdentifier(Key.Parse("5KbdaBwc9Eit2LrmDp1WfZd815StNstwHanbRrPpGGN6wWJKyHe", Network.Main), key.PubKey.GetScriptPubKey(ScriptPubKeyType.Segwit)),
- WabiSabiFactory.CreateCommitmentData(roundHash));
+ WabiSabiFactory.CreateCommitmentData(roundHash),
+ ScriptPubKeyType.Segwit);
}

MODIFY
WalletWasabi/Crypto/OwnershipProof.cs
WalletWasabi/Crypto/OwnershipProof.cs
@@ -44,7 +44,7 @@ public record OwnershipProof : IBitcoinSerializable
private static OwnershipProof GenerateOwnershipProof(Key key, byte[] commitmentData, ProofBody proofBody, ScriptPubKeyType scriptPubKeyType) =>
new(
proofBody,
- Bip322Signature.Generate(key, proofBody.SignatureHash(key.PubKey.GetScriptPubKey(ScriptPubKeyType.Segwit), commitmentData), scriptPubKeyType));
+ Bip322Signature.Generate(key, proofBody.SignatureHash(key.PubKey.GetScriptPubKey(scriptPubKeyType), commitmentData), scriptPubKeyType));
public bool VerifyOwnership(Script scriptPubKey, byte[] commitmentData, bool requireUserConfirmation) =>
scriptPubKey.GetScriptType() switch
@@ -65,11 +65,11 @@ public record OwnershipProof : IBitcoinSerializable
return _proofSignature.Verify(hash, scriptPubKey);
}
- public static OwnershipProof GenerateCoinJoinInputProof(Key key, OwnershipIdentifier ownershipIdentifier, CoinJoinInputCommitmentData coinJoinInputsCommitmentData) =>
- Generate(key, new[] { ownershipIdentifier }, coinJoinInputsCommitmentData.ToBytes(), true, ScriptPubKeyType.Segwit);
+ public static OwnershipProof GenerateCoinJoinInputProof(Key key, OwnershipIdentifier ownershipIdentifier, CoinJoinInputCommitmentData coinJoinInputsCommitmentData, ScriptPubKeyType scriptPubKeyType) =>
+ Generate(key, new[] { ownershipIdentifier }, coinJoinInputsCommitmentData.ToBytes(), true, scriptPubKeyType);
- public static OwnershipProof GenerateCoinJoinInputProof(Key key, IEnumerable<OwnershipIdentifier> ownershipIdentifiers, CoinJoinInputCommitmentData coinJoinInputsCommitmentData) =>
- Generate(key, ownershipIdentifiers, coinJoinInputsCommitmentData.ToBytes(), true, ScriptPubKeyType.Segwit);
+ public static OwnershipProof GenerateCoinJoinInputProof(Key key, IEnumerable<OwnershipIdentifier> ownershipIdentifiers, CoinJoinInputCommitmentData coinJoinInputsCommitmentData, ScriptPubKeyType scriptPubKeyType) =>
+ Generate(key, ownershipIdentifiers, coinJoinInputsCommitmentData.ToBytes(), true, scriptPubKeyType);
public static bool VerifyCoinJoinInputProof(OwnershipProof ownershipProofBytes, Script scriptPubKey, CoinJoinInputCommitmentData coinJoinInputsCommitmentData) =>
ownershipProofBytes.VerifyOwnership(scriptPubKey, coinJoinInputsCommitmentData.ToBytes(), true);

MODIFY
WalletWasabi/WabiSabi/Client/BaseKeyChain.cs
WalletWasabi/WabiSabi/Client/BaseKeyChain.cs
@@ -31,7 +31,9 @@ public abstract class BaseKeyChain : IKeyChain
var ownershipProof = OwnershipProof.GenerateCoinJoinInputProof(
signingKey,
new OwnershipIdentifier(identificationKey, destination.ScriptPubKey),
- commitmentData);
+ commitmentData,
+ ScriptPubKeyType.TaprootBIP86
+ );
return ownershipProof;
}

Extend parameters of GenerateOwnershipProof by script type