Make it recursive
MODIFY
WalletWasabi/Blockchain/Analysis/BlockchainAnalyzer.cs
WalletWasabi/Blockchain/Analysis/BlockchainAnalyzer.cs
@@ -80,7 +80,7 @@ public class BlockchainAnalyzer
// Group all of the transaction inputs by the TXID from which they originated.
// Discard the groups which do not contain a wallet input.
- var walletInputTxs = tx.WalletInputs.Select(x => x.Transaction).ToHashSet();
+ var walletInputTxs = tx.GetAllOwnPreviousTransactions().ToHashSet();
var walletInputTxIds = walletInputTxs.Select(x => x.GetHash()).ToHashSet();
Dictionary<SmartTransaction, TxIn[]> inputGroups = tx.Transaction.Inputs
.GroupBy(x => x.PrevOut.Hash)

MODIFY
WalletWasabi/Blockchain/Transactions/SmartTransaction.cs
WalletWasabi/Blockchain/Transactions/SmartTransaction.cs
@@ -196,6 +196,19 @@ public class SmartTransaction : IEquatable<SmartTransaction>
=> WalletInputs.Any() // We must be a participant in order to be this transaction our coinjoin.
&& Transaction.Inputs.Count != WalletInputs.Count; // Some inputs must not be ours for it to be a coinjoin.
+ public IEnumerable<SmartTransaction> GetAllOwnPreviousTransactions()
+ {
+ foreach (var tx in WalletInputs.Select(x => x.Transaction))
+ {
+ yield return tx;
+
+ foreach (var innerTx in tx.GetAllOwnPreviousTransactions())
+ {
+ yield return innerTx;
+ }
+ }
+ }
+
#region LineSerialization
public string ToLine()

Make it recursive