mirror of
https://github.com/jwinterm/grin-wallet.git
synced 2026-10-17 15:21:39 +02:00
move result count limiting to after sorting
This commit is contained in:
@@ -104,7 +104,7 @@ where
|
||||
K: Keychain + 'a,
|
||||
{
|
||||
// Apply simple bool, GTE or LTE fields
|
||||
let mut txs_iter: Box<dyn Iterator<Item = TxLogEntry>> = Box::new(
|
||||
let txs_iter: Box<dyn Iterator<Item = TxLogEntry>> = Box::new(
|
||||
wallet
|
||||
.tx_log_iter()
|
||||
.filter(|tx_entry| {
|
||||
@@ -273,11 +273,6 @@ where
|
||||
}),
|
||||
);
|
||||
|
||||
// Apply limit if requested
|
||||
if let Some(l) = query_args.limit {
|
||||
txs_iter = Box::new(txs_iter.take(l as usize));
|
||||
}
|
||||
|
||||
let mut return_txs: Vec<TxLogEntry> = txs_iter.collect();
|
||||
|
||||
// Now apply requested sorting
|
||||
@@ -321,6 +316,11 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
// Apply limit if requested
|
||||
if let Some(l) = query_args.limit {
|
||||
return_txs = return_txs.into_iter().take(l as usize).collect()
|
||||
}
|
||||
|
||||
return_txs
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user