Extract ID for hdpubkeys, too
MODIFY
WalletWasabi/Blockchain/TransactionOutputs/ForeignVirtualOutput.cs
WalletWasabi/Blockchain/TransactionOutputs/ForeignVirtualOutput.cs
@@ -9,16 +9,16 @@ namespace WalletWasabi.Blockchain.TransactionOutputs;
public class ForeignVirtualOutput
{
- /// <param name="keyId">Unique public key identifier or if we can't have that, then the scriptpubkey byte array.</param>
- public ForeignVirtualOutput(byte[] keyId, Money amount, ISet<OutPoint> outPoints)
+ /// <param name="id">Unique public key identifier or if we can't have that, then the scriptpubkey byte array.</param>
+ public ForeignVirtualOutput(byte[] id, Money amount, ISet<OutPoint> outPoints)
{
- KeyId = keyId;
+ Id = id;
Amount = amount;
OutPoints = outPoints;
}
/// <summary>Unique public key identifier or if we can't have that, then the scriptpubkey byte array. </summary>
- public byte[] KeyId { get; }
+ public byte[] Id { get; }
public Money Amount { get; }
public ISet<OutPoint> OutPoints { get; }

MODIFY
WalletWasabi/Blockchain/TransactionOutputs/WalletVirtualInput.cs
WalletWasabi/Blockchain/TransactionOutputs/WalletVirtualInput.cs
+using NBitcoin;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -9,12 +10,12 @@ namespace WalletWasabi.Blockchain.TransactionOutputs;
public class WalletVirtualInput
{
- public WalletVirtualInput(HdPubKey hdPubKey, ISet<SmartCoin> coins)
+ public WalletVirtualInput(byte[] id, ISet<SmartCoin> coins)
{
- HdPubKey = hdPubKey;
+ Id = id;
Coins = coins;
}
- public HdPubKey HdPubKey { get; }
+ public byte[] Id { get; }
public ISet<SmartCoin> Coins { get; }
}

MODIFY
WalletWasabi/Blockchain/TransactionOutputs/WalletVirtualOutput.cs
WalletWasabi/Blockchain/TransactionOutputs/WalletVirtualOutput.cs
@@ -10,14 +10,14 @@ namespace WalletWasabi.Blockchain.TransactionOutputs;
public class WalletVirtualOutput
{
- public WalletVirtualOutput(HdPubKey hdPubKey, Money amount, ISet<OutPoint> outPoints)
+ public WalletVirtualOutput(byte[] id, Money amount, ISet<OutPoint> outPoints)
{
- HdPubKey = hdPubKey;
+ Id = id;
Amount = amount;
OutPoints = outPoints;
}
- public HdPubKey HdPubKey { get; }
+ public byte[] Id { get; }
public Money Amount { get; }
public ISet<OutPoint> OutPoints { get; }
}

MODIFY
WalletWasabi/Blockchain/Transactions/SmartTransaction.cs
WalletWasabi/Blockchain/Transactions/SmartTransaction.cs
@@ -100,7 +100,7 @@ public class SmartTransaction : IEquatable<SmartTransaction>
if (WalletVirtualInputsCache is null)
{
WalletVirtualInputsCache = WalletInputs
- .GroupBy(i => i.HdPubKey)
+ .GroupBy(i => i.HdPubKey.PubKeyHash.ToBytes())
.Select(g => new WalletVirtualInput(g.Key, g.ToHashSet()))
.ToHashSet();
}
@@ -116,7 +116,7 @@ public class SmartTransaction : IEquatable<SmartTransaction>
if (WalletVirtualOutputsCache is null)
{
WalletVirtualOutputsCache = WalletOutputs
- .GroupBy(o => o.HdPubKey)
+ .GroupBy(o => o.HdPubKey.PubKeyHash.ToBytes())
.Select(g => new WalletVirtualOutput(g.Key, g.Sum(o => o.Amount), g.Select(o => new OutPoint(GetHash(), o.Index)).ToHashSet()))
.ToHashSet();
}

MODIFY
WalletWasabi/Extensions/NBitcoinExtensions.cs
WalletWasabi/Extensions/NBitcoinExtensions.cs
@@ -500,13 +500,15 @@ public static class NBitcoinExtensions
/// Extracts a unique public key identifier. If it can't do that, then it returns the scriptpubkey byte array.
/// </summary>
public static byte[] ExtractKeyId(this Script scriptPubKey)
- => scriptPubKey.TryGetScriptType() switch
+ {
+ return scriptPubKey.TryGetScriptType() switch
{
ScriptType.P2WPKH => PayToWitPubKeyHashTemplate.Instance.ExtractScriptPubKeyParameters(scriptPubKey)!.ToBytes(),
ScriptType.P2PKH => PayToPubkeyHashTemplate.Instance.ExtractScriptPubKeyParameters(scriptPubKey)!.ToBytes(),
ScriptType.P2PK => PayToPubkeyTemplate.Instance.ExtractScriptPubKeyParameters(scriptPubKey)!.ToBytes(),
_ => scriptPubKey.ToBytes()
};
+ }
public static ScriptType? TryGetScriptType(this Script script)
{

Extract ID for hdpubkeys, too