After a utxo rescan, the cached balance should be invalidated

This commit is contained in:
nicolas.dorier
2022-05-27 16:26:31 +09:00
committed by Kukks
parent a9e08dd587
commit 20d653798c
4 changed files with 9 additions and 7 deletions

View File

@@ -102,7 +102,7 @@ namespace BTCPayServer.Controllers
CustomCSSLink = settings.CustomCSSLink, CustomCSSLink = settings.CustomCSSLink,
CustomLogoLink = storeBlob.CustomLogo, CustomLogoLink = storeBlob.CustomLogo,
AppId = appId, AppId = appId,
Store = store, StoreId = store.Id,
Description = settings.Description, Description = settings.Description,
EmbeddedCSS = settings.EmbeddedCSS, EmbeddedCSS = settings.EmbeddedCSS,
RequiresRefundEmail = settings.RequiresRefundEmail RequiresRefundEmail = settings.RequiresRefundEmail

View File

@@ -1158,6 +1158,7 @@ namespace BTCPayServer.Controllers
{ {
await explorer.ScanUTXOSetAsync(paymentMethod.AccountDerivation, vm.BatchSize, vm.GapLimit, await explorer.ScanUTXOSetAsync(paymentMethod.AccountDerivation, vm.BatchSize, vm.GapLimit,
vm.StartingIndex); vm.StartingIndex);
_walletProvider.GetWallet(walletId.CryptoCode).InvalidateCache(paymentMethod.AccountDerivation);
} }
catch (NBXplorerException ex) when (ex.Error.Code == "scanutxoset-in-progress") catch (NBXplorerException ex) when (ex.Error.Code == "scanutxoset-in-progress")
{ {

View File

@@ -1,5 +1,4 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using BTCPayServer.Data;
using BTCPayServer.Services.Apps; using BTCPayServer.Services.Apps;
namespace BTCPayServer.Models.AppViewModels namespace BTCPayServer.Models.AppViewModels
@@ -66,7 +65,6 @@ namespace BTCPayServer.Models.AppViewModels
[Display(Name = "Custom CSS Code")] [Display(Name = "Custom CSS Code")]
public string EmbeddedCSS { get; set; } public string EmbeddedCSS { get; set; }
public RequiresRefundEmail RequiresRefundEmail { get; set; } = RequiresRefundEmail.InheritFromStore; public RequiresRefundEmail RequiresRefundEmail { get; set; } = RequiresRefundEmail.InheritFromStore;
public string StoreId { get; set; }
public StoreData Store { get; set; }
} }
} }

View File

@@ -1,7 +1,9 @@
@using BTCPayServer.Models.AppViewModels @using BTCPayServer.Models.AppViewModels
@using BTCPayServer.Payments.Lightning @using BTCPayServer.Payments.Lightning
@using BTCPayServer.Services.Stores
@using LNURL @using LNURL
@inject BTCPayNetworkProvider BTCPayNetworkProvider @inject BTCPayNetworkProvider BTCPayNetworkProvider
@inject StoreRepository StoreRepository
@model BTCPayServer.Models.AppViewModels.ViewPointOfSaleViewModel @model BTCPayServer.Models.AppViewModels.ViewPointOfSaleViewModel
<style> <style>
@@ -16,11 +18,12 @@
</style> </style>
@{ @{
var store = await StoreRepository.FindStore(Model.StoreId);
Layout = "_LayoutPos"; Layout = "_LayoutPos";
Context.Request.Query.TryGetValue("cryptocode", out var cryptoCodeValues); Context.Request.Query.TryGetValue("cryptocode", out var cryptoCodeValues);
var cryptoCode = cryptoCodeValues.FirstOrDefault() ?? "BTC"; var cryptoCode = cryptoCodeValues.FirstOrDefault() ?? "BTC";
var supported = Model.Store.GetSupportedPaymentMethods(BTCPayNetworkProvider).OfType<LNURLPaySupportedPaymentMethod>().OrderBy(method => method.CryptoCode == cryptoCode).FirstOrDefault(); var supported = store.GetSupportedPaymentMethods(BTCPayNetworkProvider).OfType<LNURLPaySupportedPaymentMethod>().OrderBy(method => method.CryptoCode == cryptoCode).FirstOrDefault();
if (supported != null && !Model.Store.GetEnabledPaymentIds(BTCPayNetworkProvider).Contains(supported.PaymentId)) if (supported != null && !store.GetEnabledPaymentIds(BTCPayNetworkProvider).Contains(supported.PaymentId))
{ {
supported = null; supported = null;
} }
@@ -30,7 +33,7 @@
{ {
<div class="alert alert-warning text-center sticky-top mb-0 rounded-0" role="alert"> <div class="alert alert-warning text-center sticky-top mb-0 rounded-0" role="alert">
LNURL is not enabled on your store, which this print feature relies on. LNURL is not enabled on your store, which this print feature relies on.
<a asp-controller="UIStores" asp-action="LightningSettings" asp-route-cryptoCode="BTC" asp-route-storeId="@Model.Store.Id" class="alert-link p-0"> <a asp-controller="UIStores" asp-action="LightningSettings" asp-route-cryptoCode="BTC" asp-route-storeId="@store.Id" class="alert-link p-0">
Enable LNURL Enable LNURL
</a> </a>
</div> </div>