Improve IsLikelyCoinjoin
MODIFY
WalletWasabi.Fluent/Rpc/WasabiJsonRpcService.cs
WalletWasabi.Fluent/Rpc/WasabiJsonRpcService.cs
@@ -196,7 +196,7 @@ public class WasabiJsonRpcService : IJsonRpcService
amount = x.Amount.Satoshi,
label = x.Label,
tx = x.TransactionId,
- islikelycoinjoin = x.IsLikelyCoinJoinOutput
+ islikelycoinjoin = x.IsLikelyOwnCoinjoin
}).ToArray();
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryItems/CoinJoinsHistoryItemViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryItems/CoinJoinsHistoryItemViewModel.cs
@@ -27,7 +27,7 @@ public class CoinJoinsHistoryItemViewModel : HistoryItemViewModelBase
public void Add(TransactionSummary item)
{
- if (!item.IsLikelyCoinJoinOutput)
+ if (!item.IsLikelyOwnCoinjoin)
{
throw new InvalidOperationException("Not a coinjoin item!");
}

MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Home/History/HistoryViewModel.cs
@@ -136,12 +136,12 @@ public partial class HistoryViewModel : ActivatableViewModel
balance += item.Amount;
- if (!item.IsLikelyCoinJoinOutput)
+ if (!item.IsLikelyOwnCoinjoin)
{
yield return new TransactionHistoryItemViewModel(i, item, _walletViewModel, balance, _updateTrigger);
}
- if (item.IsLikelyCoinJoinOutput)
+ if (item.IsLikelyOwnCoinjoin)
{
if (coinJoinGroup is null)
{
@@ -154,7 +154,7 @@ public partial class HistoryViewModel : ActivatableViewModel
}
if (coinJoinGroup is { } cjg &&
- (i + 1 < txRecordList.Count && !txRecordList[i + 1].IsLikelyCoinJoinOutput || // The next item is not CJ so add the group.
+ (i + 1 < txRecordList.Count && !txRecordList[i + 1].IsLikelyOwnCoinjoin || // The next item is not CJ so add the group.
i == txRecordList.Count - 1)) // There is no following item in the list so add the group.
{
cjg.SetBalance(balance);

MODIFY
WalletWasabi/Blockchain/TransactionProcessing/ProcessedResult.cs
WalletWasabi/Blockchain/TransactionProcessing/ProcessedResult.cs
@@ -14,7 +14,7 @@ public class ProcessedResult
public ProcessedResult(SmartTransaction transaction)
{
Transaction = Guard.NotNull(nameof(transaction), transaction);
- _isLikelyOwnCoinJoin = new Lazy<bool>(() => Transaction.WalletInputs.Any() && Transaction.IsLikelyCoinjoin(), true);
+ _isLikelyOwnCoinJoin = new Lazy<bool>(() => Transaction.IsLikelyOwnCoinjoin(), true);
}
public SmartTransaction Transaction { get; }

MODIFY
WalletWasabi/Blockchain/Transactions/TransactionHistoryBuilder.cs
WalletWasabi/Blockchain/Transactions/TransactionHistoryBuilder.cs
@@ -49,7 +49,7 @@ public class TransactionHistoryBuilder
Label = containingTransaction.Label,
TransactionId = coin.TransactionId,
BlockIndex = containingTransaction.BlockIndex,
- IsLikelyCoinJoinOutput = containingTransaction.IsLikelyCoinjoin()
+ IsLikelyOwnCoinjoin = containingTransaction.IsLikelyOwnCoinjoin()
});
}
@@ -74,7 +74,7 @@ public class TransactionHistoryBuilder
Label = spenderTransaction.Label,
TransactionId = spenderTxId,
BlockIndex = spenderTransaction.BlockIndex,
- IsLikelyCoinJoinOutput = spenderTransaction.IsLikelyCoinjoin()
+ IsLikelyOwnCoinjoin = spenderTransaction.IsLikelyOwnCoinjoin()
});
}
}

MODIFY
WalletWasabi/Blockchain/Transactions/TransactionSummary.cs
WalletWasabi/Blockchain/Transactions/TransactionSummary.cs
@@ -12,5 +12,5 @@ public class TransactionSummary
public SmartLabel Label { get; set; }
public uint256 TransactionId { get; set; }
public int BlockIndex { get; set; }
- public bool IsLikelyCoinJoinOutput { get; set; }
+ public bool IsLikelyOwnCoinjoin { get; set; }
}

MODIFY
WalletWasabi/Extensions/NBitcoinExtensions.cs
WalletWasabi/Extensions/NBitcoinExtensions.cs
@@ -150,8 +150,9 @@ public static class NBitcoinExtensions
return anonsets;
}
- public static bool IsLikelyCoinjoin(this SmartTransaction me)
- => me.Transaction.Inputs.Count != me.WalletInputs.Count // Some inputs must not be ours for it to be a coinjoin.
+ public static bool IsLikelyOwnCoinjoin(this SmartTransaction me)
+ => me.WalletInputs.Any() // We must be a participant in order to be this transaction our coinjoin.
+ && me.Transaction.Inputs.Count != me.WalletInputs.Count // Some inputs must not be ours for it to be a coinjoin.
&& me.Transaction.Outputs.Count != me.WalletOutputs.Count // Some outputs must not be ours for it to be a coinjoin.
&& me.Transaction.HasIndistinguishableOutputs(); // The tx must have more than one equal output in order to be a coinjoin.

Improve IsLikelyCoinjoin