From 572c7ebbd8c781752c5c67a39f7b54ae1daa4607 Mon Sep 17 00:00:00 2001 From: Kukks Date: Mon, 13 Jul 2020 10:54:39 +0200 Subject: [PATCH 1/2] Fix Payjoin HWW signing fixes #1557 --- BTCPayServer/Controllers/WalletsController.PSBT.cs | 7 +++++++ BTCPayServer/Views/Wallets/SigningContext.cshtml | 10 +++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/BTCPayServer/Controllers/WalletsController.PSBT.cs b/BTCPayServer/Controllers/WalletsController.PSBT.cs index 3f48ea373..8940a4ca2 100644 --- a/BTCPayServer/Controllers/WalletsController.PSBT.cs +++ b/BTCPayServer/Controllers/WalletsController.PSBT.cs @@ -314,6 +314,13 @@ namespace BTCPayServer.Controllers string error = null; try { + if (!string.IsNullOrEmpty(vm.SigningContext.OriginalPSBT) && + !string.IsNullOrEmpty(vm.SigningContext.PSBT)) + { + //if a hw device signed, we are sent back to the ready page with updated psbt data for final verification. If they are happy, they will click to broadcast with payjoin which brings us here. + return await WalletPSBTReady(walletId, vm, "broadcast"); + } + var proposedPayjoin = await GetPayjoinProposedTX(new BitcoinUrlBuilder(vm.SigningContext.PayJoinBIP21, network.NBitcoinNetwork), psbt, derivationSchemeSettings, network, cancellationToken); try diff --git a/BTCPayServer/Views/Wallets/SigningContext.cshtml b/BTCPayServer/Views/Wallets/SigningContext.cshtml index 6d69ee6d1..9e7d97e10 100644 --- a/BTCPayServer/Views/Wallets/SigningContext.cshtml +++ b/BTCPayServer/Views/Wallets/SigningContext.cshtml @@ -2,9 +2,9 @@ @if (Model != null) { - - - - - + + + + + } From eb14635a538285327b11b132e7ba4b36be15c9e3 Mon Sep 17 00:00:00 2001 From: Kukks Date: Mon, 13 Jul 2020 15:02:51 +0200 Subject: [PATCH 2/2] broadcast hww payjopin immediately --- BTCPayServer/Controllers/WalletsController.PSBT.cs | 7 ------- BTCPayServer/Controllers/WalletsController.cs | 6 ++++++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/BTCPayServer/Controllers/WalletsController.PSBT.cs b/BTCPayServer/Controllers/WalletsController.PSBT.cs index 8940a4ca2..3f48ea373 100644 --- a/BTCPayServer/Controllers/WalletsController.PSBT.cs +++ b/BTCPayServer/Controllers/WalletsController.PSBT.cs @@ -314,13 +314,6 @@ namespace BTCPayServer.Controllers string error = null; try { - if (!string.IsNullOrEmpty(vm.SigningContext.OriginalPSBT) && - !string.IsNullOrEmpty(vm.SigningContext.PSBT)) - { - //if a hw device signed, we are sent back to the ready page with updated psbt data for final verification. If they are happy, they will click to broadcast with payjoin which brings us here. - return await WalletPSBTReady(walletId, vm, "broadcast"); - } - var proposedPayjoin = await GetPayjoinProposedTX(new BitcoinUrlBuilder(vm.SigningContext.PayJoinBIP21, network.NBitcoinNetwork), psbt, derivationSchemeSettings, network, cancellationToken); try diff --git a/BTCPayServer/Controllers/WalletsController.cs b/BTCPayServer/Controllers/WalletsController.cs index 29f877821..8eed1b862 100644 --- a/BTCPayServer/Controllers/WalletsController.cs +++ b/BTCPayServer/Controllers/WalletsController.cs @@ -782,6 +782,12 @@ namespace BTCPayServer.Controllers } }; AddSigningContext(redirectVm, vm.SigningContext); + if (!string.IsNullOrEmpty(vm.SigningContext.OriginalPSBT) && + !string.IsNullOrEmpty(vm.SigningContext.PSBT)) + { + //if a hw device signed a payjoin, we want it broadcast instantly + redirectVm.Parameters.Add(new KeyValuePair("command", "broadcast")); + } return View("PostRedirect", redirectVm); }