mirror of
https://github.com/mimblewimble/grin-wallet.git
synced 2025-01-20 19:11:09 +03:00
move result count limiting to after sorting
This commit is contained in:
parent
2a599027f5
commit
319b9ca7e0
1 changed files with 6 additions and 6 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue