Add WalletInputs and WalletOutputs to SmartTransaction
MODIFY
WalletWasabi/Blockchain/TransactionOutputs/SmartCoin.cs
WalletWasabi/Blockchain/TransactionOutputs/SmartCoin.cs
@@ -38,6 +38,7 @@ namespace WalletWasabi.Blockchain.TransactionOutputs
public SmartCoin(SmartTransaction transaction, uint outputIndex, HdPubKey pubKey, int anonymitySet)
{
Transaction = transaction;
+ Transaction.WalletInputs.Add(this);
Index = outputIndex;
_transactionId = new Lazy<uint256>(() => Transaction.GetHash(), true);
@@ -89,7 +90,13 @@ namespace WalletWasabi.Blockchain.TransactionOutputs
public SmartTransaction? SpenderTransaction
{
get => _spenderTransaction;
- set => RaiseAndSetIfChanged(ref _spenderTransaction, value);
+ set
+ {
+ if (RaiseAndSetIfChanged(ref _spenderTransaction, value))
+ {
+ value?.WalletOutputs.Add(this);
+ }
+ }
}
public bool CoinJoinInProgress

MODIFY
WalletWasabi/Blockchain/Transactions/SmartTransaction.cs
WalletWasabi/Blockchain/Transactions/SmartTransaction.cs
@@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using WalletWasabi.Blockchain.Analysis.Clustering;
+using WalletWasabi.Blockchain.TransactionOutputs;
using WalletWasabi.Helpers;
using WalletWasabi.JsonConverters;
using WalletWasabi.Logging;
@@ -39,6 +40,9 @@ namespace WalletWasabi.Blockchain.Transactions
#region Members
+ public HashSet<SmartCoin> WalletInputs { get; } = new HashSet<SmartCoin>();
+ public HashSet<SmartCoin> WalletOutputs { get; } = new HashSet<SmartCoin>();
+
[JsonProperty]
[JsonConverter(typeof(TransactionJsonConverter))]
public Transaction Transaction { get; }

Add WalletInputs and WalletOutputs to SmartTransaction