Fix tx labels
MODIFY
WalletWasabi/Blockchain/TransactionProcessing/TransactionProcessor.cs
WalletWasabi/Blockchain/TransactionProcessing/TransactionProcessor.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using NBitcoin;
+using WalletWasabi.Blockchain.Analysis.Clustering;
using WalletWasabi.Blockchain.Keys;
using WalletWasabi.Blockchain.TransactionOutputs;
using WalletWasabi.Blockchain.Transactions;
@@ -172,6 +173,11 @@ namespace WalletWasabi.Blockchain.TransactionProcessing
HdPubKey foundKey = KeyManager.GetKeyForScriptPubKey(output.ScriptPubKey);
if (foundKey is { })
{
+ if (!foundKey.IsInternal)
+ {
+ tx.Label = SmartLabel.Merge(tx.Label, foundKey.Label);
+ }
+
foundKey.SetKeyState(KeyState.Used, KeyManager);
if (output.Value <= DustThreshold)
{

MODIFY
WalletWasabi/Blockchain/Transactions/TransactionFactory.cs
WalletWasabi/Blockchain/Transactions/TransactionFactory.cs
@@ -306,7 +306,8 @@ namespace WalletWasabi.Blockchain.Transactions
Logger.LogInfo($"Transaction is successfully built: {tx.GetHash()}.");
var sign = !KeyManager.IsWatchOnly;
var spendsUnconfirmed = spentCoins.Any(c => !c.Confirmed);
- return new BuildTransactionResult(new SmartTransaction(tx, Height.Unknown), psbt, spendsUnconfirmed, sign, fee, feePc, outerWalletOutputs, innerWalletOutputs, spentCoins);
+ SmartTransaction smartTransaction = new SmartTransaction(tx, Height.Unknown, label: SmartLabel.Merge(payments.Requests.Select(x => x.Label)));
+ return new BuildTransactionResult(smartTransaction, psbt, spendsUnconfirmed, sign, fee, feePc, outerWalletOutputs, innerWalletOutputs, spentCoins);
}
private PSBT TryNegotiatePayjoin(IPayjoinClient payjoinClient, TransactionBuilder builder, PSBT psbt, HdPubKey changeHdPubKey)

MODIFY
WalletWasabi/Blockchain/Transactions/TransactionHistoryBuilder.cs
WalletWasabi/Blockchain/Transactions/TransactionHistoryBuilder.cs
@@ -60,7 +60,6 @@ namespace WalletWasabi.Blockchain.Transactions
{
found.DateTime = dateTime;
found.Amount += coin.Amount;
- found.Label = SmartLabel.Merge(found.Label, coin.Label);
}
else
{
@@ -69,7 +68,7 @@ namespace WalletWasabi.Blockchain.Transactions
DateTime = dateTime,
Height = coin.Height,
Amount = coin.Amount,
- Label = coin.Label,
+ Label = foundTransaction.Label,
TransactionId = coin.TransactionId,
BlockIndex = foundTransaction.BlockIndex,
IsLikelyCoinJoinOutput = coin.IsLikelyCoinJoinOutput is true

Fix tx labels