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
No known key found for this signature in database
GPG Key ID: 8E5530D9D1C93097
4 changed files with 9 additions and 7 deletions

View File

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

View File

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

View File

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

View File

@ -1,7 +1,9 @@
@using BTCPayServer.Models.AppViewModels
@using BTCPayServer.Payments.Lightning
@using BTCPayServer.Services.Stores
@using LNURL
@inject BTCPayNetworkProvider BTCPayNetworkProvider
@inject StoreRepository StoreRepository
@model BTCPayServer.Models.AppViewModels.ViewPointOfSaleViewModel
<style>
@ -16,11 +18,12 @@
</style>
@{
var store = await StoreRepository.FindStore(Model.StoreId);
Layout = "_LayoutPos";
Context.Request.Query.TryGetValue("cryptocode", out var cryptoCodeValues);
var cryptoCode = cryptoCodeValues.FirstOrDefault() ?? "BTC";
var supported = Model.Store.GetSupportedPaymentMethods(BTCPayNetworkProvider).OfType<LNURLPaySupportedPaymentMethod>().OrderBy(method => method.CryptoCode == cryptoCode).FirstOrDefault();
if (supported != null && !Model.Store.GetEnabledPaymentIds(BTCPayNetworkProvider).Contains(supported.PaymentId))
var supported = store.GetSupportedPaymentMethods(BTCPayNetworkProvider).OfType<LNURLPaySupportedPaymentMethod>().OrderBy(method => method.CryptoCode == cryptoCode).FirstOrDefault();
if (supported != null && !store.GetEnabledPaymentIds(BTCPayNetworkProvider).Contains(supported.PaymentId))
{
supported = null;
}
@ -30,7 +33,7 @@
{
<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.
<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
</a>
</div>