Create a dedicated IsHotwalletProperty in the DerivationSchemeSettings

This commit is contained in:
nicolas.dorier
2021-06-17 15:36:22 +09:00
parent afd479ac69
commit 956370592f
4 changed files with 26 additions and 3 deletions

View File

@@ -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();