mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2026-01-06 15:44:26 +01:00
Create a dedicated IsHotwalletProperty in the DerivationSchemeSettings
This commit is contained in:
@@ -14,6 +14,7 @@ using BTCPayServer.Services;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata;
|
||||
using NBitcoin;
|
||||
using NBXplorer;
|
||||
using NBXplorer.DerivationStrategy;
|
||||
@@ -257,7 +258,8 @@ namespace BTCPayServer.Controllers
|
||||
Confirmation = string.IsNullOrEmpty(request.ExistingMnemonic),
|
||||
Network = network,
|
||||
RootKeyPath = network.GetRootKeyPath(),
|
||||
Source = "NBXplorer",
|
||||
Source = isImport ? "SeedImported" : "NBXplorerGenerated",
|
||||
IsHotWallet = isImport ? request.SavePrivateKeys : method == WalletSetupMethod.HotWallet,
|
||||
DerivationSchemeFormat = "BTCPay",
|
||||
CanUseHotWallet = true,
|
||||
CanUseRPCImport = rpcImport
|
||||
|
||||
@@ -276,8 +276,8 @@ namespace BTCPayServer
|
||||
[JsonIgnore]
|
||||
public BTCPayNetwork Network { get; set; }
|
||||
public string Source { get; set; }
|
||||
[JsonIgnore]
|
||||
public bool IsHotWallet => Source == "NBXplorer";
|
||||
|
||||
public bool IsHotWallet { get; set; }
|
||||
|
||||
[Obsolete("Use GetSigningAccountKeySettings().AccountKeyPath instead")]
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
|
||||
@@ -128,6 +128,12 @@ namespace BTCPayServer.Hosting
|
||||
settings.MigrateU2FToFIDO2 = true;
|
||||
await _Settings.UpdateSetting(settings);
|
||||
}
|
||||
if (!settings.MigrateHotwalletProperty)
|
||||
{
|
||||
await MigrateHotwalletProperty();
|
||||
settings.MigrateHotwalletProperty = true;
|
||||
await _Settings.UpdateSetting(settings);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -136,6 +142,20 @@ namespace BTCPayServer.Hosting
|
||||
}
|
||||
}
|
||||
|
||||
private async Task MigrateHotwalletProperty()
|
||||
{
|
||||
await using var ctx = _DBContextFactory.CreateContext();
|
||||
foreach (var store in await ctx.Stores.AsQueryable().ToArrayAsync())
|
||||
{
|
||||
foreach (var paymentMethod in store.GetSupportedPaymentMethods(_NetworkProvider).OfType<DerivationSchemeSettings>())
|
||||
{
|
||||
paymentMethod.IsHotWallet = paymentMethod.Source == "NBXplorer";
|
||||
paymentMethod.Source = "NBXplorerGenerated";
|
||||
}
|
||||
}
|
||||
await ctx.SaveChangesAsync();
|
||||
}
|
||||
|
||||
private async Task MigrateU2FToFIDO2()
|
||||
{
|
||||
await using var ctx = _DBContextFactory.CreateContext();
|
||||
|
||||
@@ -2,6 +2,7 @@ namespace BTCPayServer.Services
|
||||
{
|
||||
public class MigrationSettings
|
||||
{
|
||||
public bool MigrateHotwalletProperty { get; set; }
|
||||
public bool MigrateU2FToFIDO2{ get; set; }
|
||||
public bool UnreachableStoreCheck { get; set; }
|
||||
public bool DeprecatedLightningConnectionStringCheck { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user