diff --git a/BTCPayServer/Controllers/WalletsController.PSBT.cs b/BTCPayServer/Controllers/WalletsController.PSBT.cs index 30aaf769c..f855e9895 100644 --- a/BTCPayServer/Controllers/WalletsController.PSBT.cs +++ b/BTCPayServer/Controllers/WalletsController.PSBT.cs @@ -5,6 +5,7 @@ using System.Net.Http; using System.Text; using System.Threading; using System.Threading.Tasks; +using BTCPayServer.HostedServices; using BTCPayServer.ModelBinders; using BTCPayServer.Models; using BTCPayServer.Models.WalletViewModels; @@ -329,6 +330,21 @@ namespace BTCPayServer.Controllers vm.PSBT = proposedPayjoin.ToBase64(); vm.OriginalPSBT = psbt.ToBase64(); proposedPayjoin.Finalize(); + var hash = proposedPayjoin.ExtractTransaction().GetHash(); + _EventAggregator.Publish(new UpdateTransactionLabel() + { + WalletId = walletId, + TransactionLabels = new Dictionary>() + { + { + hash, + new List<(string color, string label)> + { + UpdateTransactionLabel.PayjoinLabelTemplate() + } + } + } + }); TempData.SetStatusMessageModel(new StatusMessageModel() { Severity = StatusMessageModel.StatusSeverity.Success, diff --git a/BTCPayServer/Services/Labels/LabelFactory.cs b/BTCPayServer/Services/Labels/LabelFactory.cs index 2d6b2c6c4..e590077a0 100644 --- a/BTCPayServer/Services/Labels/LabelFactory.cs +++ b/BTCPayServer/Services/Labels/LabelFactory.cs @@ -43,12 +43,13 @@ namespace BTCPayServer.Services.Labels throw new ArgumentNullException(nameof(value)); if (color == null) throw new ArgumentNullException(nameof(color)); - if (value.StartsWith("{")) + if (value.StartsWith("{", StringComparison.InvariantCultureIgnoreCase)) { var jObj = JObject.Parse(value); if (jObj.ContainsKey("value")) { var id = jObj.ContainsKey("id") ? jObj["id"].Value() : string.Empty; + var idInLabel = string.IsNullOrEmpty(id) ? string.Empty : $"({id})"; switch (jObj["value"].Value()) { case "invoice": @@ -57,7 +58,7 @@ namespace BTCPayServer.Services.Labels RawValue = value, Value = "invoice", Color = color, - Tooltip = $"Received through an invoice ({id})", + Tooltip = $"Received through an invoice {idInLabel}", Link = string.IsNullOrEmpty(id) ? null : _linkGenerator.InvoiceLink(id, request.Scheme, request.Host, request.PathBase) @@ -68,7 +69,7 @@ namespace BTCPayServer.Services.Labels RawValue = value, Value = "payjoin-exposed", Color = color, - Tooltip = $"This utxo was exposed through a payjoin proposal for an invoice ({id})", + Tooltip = $"This utxo was exposed through a payjoin proposal for an invoice {idInLabel}", Link = string.IsNullOrEmpty(id) ? null : _linkGenerator.InvoiceLink(id, request.Scheme, request.Host, request.PathBase)