From 56283df05a0279c4e9767547e6092dcad7fd9ac3 Mon Sep 17 00:00:00 2001 From: "nicolas.dorier" Date: Sun, 7 Jun 2020 09:38:15 +0900 Subject: [PATCH] Can only sign with NBX if imported with NBX --- BTCPayServer/Controllers/WalletsController.PSBT.cs | 13 ++++++++----- BTCPayServer/DerivationSchemeSettings.cs | 2 ++ .../Payments/Bitcoin/BitcoinLikePaymentHandler.cs | 3 +-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/BTCPayServer/Controllers/WalletsController.PSBT.cs b/BTCPayServer/Controllers/WalletsController.PSBT.cs index 5a2c26116..2ce64885e 100644 --- a/BTCPayServer/Controllers/WalletsController.PSBT.cs +++ b/BTCPayServer/Controllers/WalletsController.PSBT.cs @@ -475,11 +475,14 @@ namespace BTCPayServer.Controllers if (await CanUseHotWallet()) { var derivationScheme = GetDerivationSchemeSettings(walletId); - var extKey = await ExplorerClientProvider.GetExplorerClient(walletId.CryptoCode) - .GetMetadataAsync(derivationScheme.AccountDerivation, - WellknownMetadataKeys.MasterHDKey); - return SignWithSeed(walletId, - new SignWithSeedViewModel() {SeedOrKey = extKey, SigningContext = signingContext }); + if (derivationScheme.IsHotWallet) + { + var extKey = await ExplorerClientProvider.GetExplorerClient(walletId.CryptoCode) + .GetMetadataAsync(derivationScheme.AccountDerivation, + WellknownMetadataKeys.MasterHDKey); + return SignWithSeed(walletId, + new SignWithSeedViewModel() { SeedOrKey = extKey, SigningContext = signingContext }); + } } TempData.SetStatusMessageModel(new StatusMessageModel() { diff --git a/BTCPayServer/DerivationSchemeSettings.cs b/BTCPayServer/DerivationSchemeSettings.cs index 32e522e39..23a0805ec 100644 --- a/BTCPayServer/DerivationSchemeSettings.cs +++ b/BTCPayServer/DerivationSchemeSettings.cs @@ -151,6 +151,8 @@ namespace BTCPayServer [JsonIgnore] public BTCPayNetwork Network { get; set; } public string Source { get; set; } + [JsonIgnore] + public bool IsHotWallet => Source == "NBXplorer"; [Obsolete("Use GetAccountKeySettings().AccountKeyPath instead")] [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] diff --git a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs index dfb5f0519..05d38ed67 100644 --- a/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs +++ b/BTCPayServer/Payments/Bitcoin/BitcoinLikePaymentHandler.cs @@ -169,8 +169,7 @@ namespace BTCPayServer.Payments.Bitcoin var prefix = $"{supportedPaymentMethod.PaymentId.ToPrettyString()}:"; var nodeSupport = _dashboard?.Get(network.CryptoCode)?.Status?.BitcoinStatus?.Capabilities ?.CanSupportTransactionCheck is true; - bool isHotwallet = supportedPaymentMethod.Source == "NBXplorer"; - onchainMethod.PayjoinEnabled &= isHotwallet && nodeSupport; + onchainMethod.PayjoinEnabled &= supportedPaymentMethod.IsHotWallet && nodeSupport; if (!isHotwallet) logs.Write($"{prefix} Payjoin should have been enabled, but your store is not a hotwallet"); if (!nodeSupport)