diff --git a/BTCPayServer.Common/BTCPayServer.Common.csproj b/BTCPayServer.Common/BTCPayServer.Common.csproj index 5b4eed1b9..08f04f2a5 100644 --- a/BTCPayServer.Common/BTCPayServer.Common.csproj +++ b/BTCPayServer.Common/BTCPayServer.Common.csproj @@ -4,7 +4,7 @@ - - + + diff --git a/BTCPayServer.Tests/BTCPayServer.Tests.csproj b/BTCPayServer.Tests/BTCPayServer.Tests.csproj index 3ff6203eb..5691b1fa3 100644 --- a/BTCPayServer.Tests/BTCPayServer.Tests.csproj +++ b/BTCPayServer.Tests/BTCPayServer.Tests.csproj @@ -10,9 +10,9 @@ - + - + all diff --git a/BTCPayServer.Tests/UnitTest1.cs b/BTCPayServer.Tests/UnitTest1.cs index 707aae83a..4f5a4899a 100644 --- a/BTCPayServer.Tests/UnitTest1.cs +++ b/BTCPayServer.Tests/UnitTest1.cs @@ -758,7 +758,7 @@ namespace BTCPayServer.Tests rescan.GapLimit = 100; // Sending a coin - var txId = tester.ExplorerNode.SendToAddress(btcDerivationScheme.Derive(new KeyPath("0/90")).ScriptPubKey, Money.Coins(1.0m)); + var txId = tester.ExplorerNode.SendToAddress(btcDerivationScheme.GetDerivation(new KeyPath("0/90")).ScriptPubKey, Money.Coins(1.0m)); tester.ExplorerNode.Generate(1); var transactions = Assert.IsType(Assert.IsType(walletController.WalletTransactions(walletId).Result).Model); Assert.Empty(transactions.Transactions); @@ -2791,7 +2791,7 @@ donation: Assert.Equal("Coldcard Import 0x60d1af8b", settings.Label); Assert.Equal("49'/0'/0'", settings.AccountKeySettings[0].AccountKeyPath.ToString()); Assert.Equal("ypub6WWc2gWwHbdnAAyJDnR4SPL1phRh7REqrPBfZeizaQ1EmTshieRXJC3Z5YoU4wkcdKHEjQGkh6AYEzCQC1Kz3DNaWSwdc1pc8416hAjzqyD", settings.AccountOriginal); - Assert.Equal(root.Derive(new KeyPath("m/49'/0'/0'")).Neuter().PubKey.WitHash.ScriptPubKey.Hash.ScriptPubKey, settings.AccountDerivation.Derive(new KeyPath()).ScriptPubKey); + Assert.Equal(root.Derive(new KeyPath("m/49'/0'/0'")).Neuter().PubKey.WitHash.ScriptPubKey.Hash.ScriptPubKey, settings.AccountDerivation.GetDerivation().ScriptPubKey); var testnet = new BTCPayNetworkProvider(NetworkType.Testnet).GetNetwork("BTC"); diff --git a/BTCPayServer.Tests/docker-compose.yml b/BTCPayServer.Tests/docker-compose.yml index 472f9d565..19a355e3a 100644 --- a/BTCPayServer.Tests/docker-compose.yml +++ b/BTCPayServer.Tests/docker-compose.yml @@ -119,7 +119,7 @@ services: - "bitcoin_datadir:/data" customer_lightningd: - image: btcpayserver/lightning:v0.7.0-1-dev + image: btcpayserver/lightning:v0.7.2-dev stop_signal: SIGKILL restart: unless-stopped environment: @@ -166,7 +166,7 @@ services: - merchant_lightningd merchant_lightningd: - image: btcpayserver/lightning:v0.7.0-1-dev + image: btcpayserver/lightning:v0.7.2-dev stop_signal: SIGKILL environment: EXPOSE_TCP: "true" diff --git a/BTCPayServer/BTCPayServer.csproj b/BTCPayServer/BTCPayServer.csproj index 6299c721a..be2f2dd4e 100644 --- a/BTCPayServer/BTCPayServer.csproj +++ b/BTCPayServer/BTCPayServer.csproj @@ -30,7 +30,7 @@ - + diff --git a/BTCPayServer/Controllers/ManageController.2FA.cs b/BTCPayServer/Controllers/ManageController.2FA.cs index b1f545a11..bf92763a9 100644 --- a/BTCPayServer/Controllers/ManageController.2FA.cs +++ b/BTCPayServer/Controllers/ManageController.2FA.cs @@ -105,7 +105,7 @@ namespace BTCPayServer.Controllers } // Strip spaces and hypens - var verificationCode = model.Code.Replace(" ", string.Empty).Replace("-", string.Empty); + var verificationCode = model.Code.Replace(" ", string.Empty, StringComparison.OrdinalIgnoreCase).Replace("-", string.Empty, StringComparison.OrdinalIgnoreCase); var is2faTokenValid = await _userManager.VerifyTwoFactorTokenAsync( user, _userManager.Options.Tokens.AuthenticatorTokenProvider, verificationCode); diff --git a/BTCPayServer/Controllers/StoresController.BTCLike.cs b/BTCPayServer/Controllers/StoresController.BTCLike.cs index 98ea11f86..ccc60001a 100644 --- a/BTCPayServer/Controllers/StoresController.BTCLike.cs +++ b/BTCPayServer/Controllers/StoresController.BTCLike.cs @@ -330,14 +330,15 @@ namespace BTCPayServer.Controllers private IActionResult ShowAddresses(DerivationSchemeViewModel vm, DerivationSchemeSettings strategy) { vm.DerivationScheme = strategy.AccountDerivation.ToString(); + var deposit = new NBXplorer.KeyPathTemplates(null).GetKeyPathTemplate(DerivationFeature.Deposit); if (!string.IsNullOrEmpty(vm.DerivationScheme)) { - var line = strategy.AccountDerivation.GetLineFor(DerivationFeature.Deposit); + var line = strategy.AccountDerivation.GetLineFor(deposit); for (int i = 0; i < 10; i++) { var address = line.Derive((uint)i); - vm.AddressSamples.Add((DerivationStrategyBase.GetKeyPath(DerivationFeature.Deposit).Derive((uint)i).ToString(), address.ScriptPubKey.GetDestinationAddress(strategy.Network.NBitcoinNetwork).ToString())); + vm.AddressSamples.Add((deposit.GetKeyPath((uint)i).ToString(), address.ScriptPubKey.GetDestinationAddress(strategy.Network.NBitcoinNetwork).ToString())); } } vm.Confirmation = true; diff --git a/BTCPayServer/DerivationSchemeParser.cs b/BTCPayServer/DerivationSchemeParser.cs index d801aa2a6..5fea6d36c 100644 --- a/BTCPayServer/DerivationSchemeParser.cs +++ b/BTCPayServer/DerivationSchemeParser.cs @@ -159,7 +159,7 @@ namespace BTCPayServer var firstKeyPath = new KeyPath("0/0"); if (HintScriptPubKey == null) return result; - if (HintScriptPubKey == result.Derive(firstKeyPath).ScriptPubKey) + if (HintScriptPubKey == result.GetDerivation(firstKeyPath).ScriptPubKey) return result; if (result is MultisigDerivationStrategy) @@ -170,7 +170,7 @@ namespace BTCPayServer foreach (var labels in ItemCombinations(hintLabels.ToList())) { var hinted = facto.Parse(resultNoLabels + '-' + string.Join('-', labels.Select(l => $"[{l}]").ToArray())); - if (HintScriptPubKey == hinted.Derive(firstKeyPath).ScriptPubKey) + if (HintScriptPubKey == hinted.GetDerivation(firstKeyPath).ScriptPubKey) return hinted; } throw new FormatException("Could not find any match"); diff --git a/BTCPayServer/Services/HardwareWalletService.cs b/BTCPayServer/Services/HardwareWalletService.cs index 188a9f066..58c8608f4 100644 --- a/BTCPayServer/Services/HardwareWalletService.cs +++ b/BTCPayServer/Services/HardwareWalletService.cs @@ -34,7 +34,7 @@ namespace BTCPayServer.Services public async Task FindKeyPathFromDerivation(BTCPayNetwork network, DerivationStrategyBase derivationScheme, CancellationToken cancellation) { var pubKeys = derivationScheme.GetExtPubKeys().Select(k => k.GetPublicKey()).ToArray(); - var derivation = derivationScheme.Derive(new KeyPath(0)); + var derivation = derivationScheme.GetDerivation(new KeyPath(0)); List derivations = new List(); if (network.NBitcoinNetwork.Consensus.SupportSegwit) {