Display PubKey and KeyPath in coins
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml
<TextBlock Text="Anonymity Set:" Grid.Row="5" />
<controls:ExtendedTextBox Classes="selectableTextBlock Transaparent" Text="{Binding AnonymitySet}" Grid.Column="1" Grid.Row="5" />
+
+ <TextBlock Text="Key Path:" Grid.Row="6" />
+ <controls:ExtendedTextBox Classes="selectableTextBlock Transaparent" Text="{Binding KeyPath}" Grid.Column="1" Grid.Row="6" />
+
+ <TextBlock Text="Public Key:" Grid.Row="7" />
+ <controls:ExtendedTextBox Classes="selectableTextBlock Transaparent" Text="{Binding PubKey}" Grid.Column="1" Grid.Row="7" />
</Grid>
</StackPanel>
</Expander>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinViewModel.cs
@@ -143,6 +143,10 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
public string History => Model.History;
+ public string PubKey => Model.HdPubKey.PubKey.ToString();
+
+ public string KeyPath => Model.HdPubKey.FullKeyPath.ToString();
+
public SmartCoinStatus Status
{
get

MODIFY
WalletWasabi/Models/SmartCoin.cs
WalletWasabi/Models/SmartCoin.cs
@@ -4,6 +4,7 @@ using System;
using System.ComponentModel;
using WalletWasabi.Helpers;
using WalletWasabi.JsonConverters;
+using WalletWasabi.KeyManagement;
namespace WalletWasabi.Models
{
@@ -49,6 +50,8 @@ namespace WalletWasabi.Models
private int _anonymitySet;
private string _history;
+ private HdPubKey _hdPubKey;
+
#endregion Fields
#region Properties
@@ -291,6 +294,19 @@ namespace WalletWasabi.Models
}
}
+ public HdPubKey HdPubKey
+ {
+ get => _hdPubKey;
+ private set
+ {
+ if (value != _hdPubKey)
+ {
+ _hdPubKey = value;
+ OnPropertyChanged(nameof(HdPubKey));
+ }
+ }
+ }
+
#endregion NonSerializableProperties
#region DependentProperties
@@ -401,12 +417,12 @@ namespace WalletWasabi.Models
#region Constructors
[JsonConstructor]
- public SmartCoin(uint256 transactionId, uint index, Script scriptPubKey, Money amount, TxoRef[] spentOutputs, Height height, bool rbf, int mixin, string label = "", uint256 spenderTransactionId = null, bool coinJoinInProgress = false, DateTimeOffset? bannedUntilUtc = null, bool spentAccordingToBackend = false)
+ public SmartCoin(uint256 transactionId, uint index, Script scriptPubKey, Money amount, TxoRef[] spentOutputs, Height height, bool rbf, int mixin, string label = "", uint256 spenderTransactionId = null, bool coinJoinInProgress = false, DateTimeOffset? bannedUntilUtc = null, bool spentAccordingToBackend = false, HdPubKey pubKey = null)
{
- Create(transactionId, index, scriptPubKey, amount, spentOutputs, height, rbf, mixin, label, spenderTransactionId, coinJoinInProgress, bannedUntilUtc, spentAccordingToBackend);
+ Create(transactionId, index, scriptPubKey, amount, spentOutputs, height, rbf, mixin, label, spenderTransactionId, coinJoinInProgress, bannedUntilUtc, spentAccordingToBackend, pubKey);
}
- public SmartCoin(Coin coin, TxoRef[] spentOutputs, Height height, bool rbf, int mixin, string label = "", uint256 spenderTransactionId = null, bool coinJoinInProgress = false, DateTimeOffset? bannedUntilUtc = null, bool spentAccordingToBackend = false)
+ public SmartCoin(Coin coin, TxoRef[] spentOutputs, Height height, bool rbf, int mixin, string label = "", uint256 spenderTransactionId = null, bool coinJoinInProgress = false, DateTimeOffset? bannedUntilUtc = null, bool spentAccordingToBackend = false, HdPubKey pubKey = null)
{
OutPoint outpoint = Guard.NotNull($"{coin}.{coin?.Outpoint}", coin?.Outpoint);
uint256 transactionId = outpoint.Hash;
@@ -414,10 +430,10 @@ namespace WalletWasabi.Models
Script scriptPubKey = Guard.NotNull($"{coin}.{coin?.ScriptPubKey}", coin?.ScriptPubKey);
Money amount = Guard.NotNull($"{coin}.{coin?.Amount}", coin?.Amount);
- Create(transactionId, index, scriptPubKey, amount, spentOutputs, height, rbf, mixin, label, spenderTransactionId, coinJoinInProgress, bannedUntilUtc, spentAccordingToBackend);
+ Create(transactionId, index, scriptPubKey, amount, spentOutputs, height, rbf, mixin, label, spenderTransactionId, coinJoinInProgress, bannedUntilUtc, spentAccordingToBackend, pubKey);
}
- private void Create(uint256 transactionId, uint index, Script scriptPubKey, Money amount, TxoRef[] spentOutputs, Height height, bool rbf, int mixin, string label, uint256 spenderTransactionId, bool coinJoinInProgress, DateTimeOffset? bannedUntilUtc, bool spentAccordingToBackend)
+ private void Create(uint256 transactionId, uint index, Script scriptPubKey, Money amount, TxoRef[] spentOutputs, Height height, bool rbf, int mixin, string label, uint256 spenderTransactionId, bool coinJoinInProgress, DateTimeOffset? bannedUntilUtc, bool spentAccordingToBackend, HdPubKey pubKey)
{
TransactionId = Guard.NotNull(nameof(transactionId), transactionId);
Index = Guard.NotNull(nameof(index), index);
@@ -435,6 +451,8 @@ namespace WalletWasabi.Models
BannedUntilUtc = bannedUntilUtc;
SpentAccordingToBackend = spentAccordingToBackend;
+ HdPubKey = pubKey;
+
SetConfirmed();
SetAnonymitySet();
SetUnspent();

MODIFY
WalletWasabi/Services/WalletService.cs
WalletWasabi/Services/WalletService.cs
@@ -538,7 +538,7 @@ namespace WalletWasabi.Services
}
}
- SmartCoin newCoin = new SmartCoin(txId, i, output.ScriptPubKey, output.Value, tx.Transaction.Inputs.ToTxoRefs().ToArray(), tx.Height, tx.Transaction.RBF, mixin, foundKey.Label, spenderTransactionId: null, false); // Don't inherit locked status from key, that's different.
+ SmartCoin newCoin = new SmartCoin(txId, i, output.ScriptPubKey, output.Value, tx.Transaction.Inputs.ToTxoRefs().ToArray(), tx.Height, tx.Transaction.RBF, mixin, foundKey.Label, spenderTransactionId: null, false, pubKey: foundKey); // Don't inherit locked status from key, that's different.
// If we didn't have it.
if (Coins.TryAdd(newCoin))
{
@@ -1151,8 +1151,10 @@ namespace WalletWasabi.Services
{
TxOut output = tx.Outputs[i];
var mixin = tx.GetMixin(i) + spentCoins.Min(x => x.Mixin);
- var coin = new SmartCoin(tx.GetHash(), i, output.ScriptPubKey, output.Value, tx.Inputs.ToTxoRefs().ToArray(), Height.Unknown, tx.RBF, mixin);
- if (KeyManager.GetKeys(KeyState.Clean).Select(x => x.GetP2wpkhScript()).Contains(coin.ScriptPubKey))
+ var foundKey = KeyManager.GetKeys(KeyState.Clean).FirstOrDefault(x => output.ScriptPubKey == x.GetP2wpkhScript());
+ var coin = new SmartCoin(tx.GetHash(), i, output.ScriptPubKey, output.Value, tx.Inputs.ToTxoRefs().ToArray(), Height.Unknown, tx.RBF, mixin, pubKey: foundKey);
+
+ if (foundKey != null)
{
coin.Label = changeLabel;
innerWalletOutputs.Add(coin);

Display PubKey and KeyPath in coins