Skip to content

Commit

Permalink
Do not prefilter if label filter in transaction view
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasDorier committed Jul 6, 2022
1 parent 9ec2052 commit 67abc10
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions BTCPayServer/Controllers/UIWalletsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,10 @@ public async Task<IActionResult> WalletTransactions(
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 };
Expand Down Expand Up @@ -326,7 +329,7 @@ public async Task<IActionResult> WalletTransactions(
}

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

Expand Down

0 comments on commit 67abc10

Please sign in to comment.