Do not prefilter if label filter in transaction view

This commit is contained in:
nicolas.dorier 2022-07-06 13:00:23 +09:00
parent 9ec2052428
commit 67abc107c5
No known key found for this signature in database
GPG key ID: 6618763EF09186FE

View file

@ -281,7 +281,10 @@ namespace BTCPayServer.Controllers
var wallet = _walletProvider.GetWallet(paymentMethod.Network);
var walletBlobAsync = WalletRepository.GetWalletInfo(walletId);
var walletTransactionsInfoAsync = WalletRepository.GetWalletTransactionsInfo(walletId);
var transactions = await wallet.FetchTransactionHistory(paymentMethod.AccountDerivation, skip, count);
// We can't filter at the database level if we need to apply label filter
var preFiltering = string.IsNullOrEmpty(labelFilter);
var transactions = await wallet.FetchTransactionHistory(paymentMethod.AccountDerivation, preFiltering ? skip : null, preFiltering ? count : null);
var walletBlob = await walletBlobAsync;
var walletTransactionsInfo = await walletTransactionsInfoAsync;
var model = new ListTransactionsViewModel { Skip = skip, Count = count };
@ -326,7 +329,7 @@ namespace BTCPayServer.Controllers
}
model.Total = model.Transactions.Count;
model.Transactions = model.Transactions.OrderByDescending(t => t.Timestamp).Skip(skip).Take(count)
model.Transactions = model.Transactions.Skip(skip).Take(count)
.ToList();
}