@@ -101,7 +101,7 @@ impl Mempool for InMemoryMempool {
101101 Ok ( ( ) )
102102 }
103103
104- fn get_top_operations ( & self , n : usize ) -> impl Iterator < Item = Arc < WrappedUserOperation > > {
104+ fn get_top_operations ( & self , n : usize ) -> Vec < Arc < WrappedUserOperation > > {
105105 self . best
106106 . iter ( )
107107 . filter_map ( |op_by_fee| {
@@ -127,6 +127,7 @@ impl Mempool for InMemoryMempool {
127127 }
128128 } )
129129 . take ( n)
130+ . collect ( )
130131 }
131132
132133 fn remove_operation (
@@ -310,15 +311,15 @@ mod tests {
310311
311312 mempool. add_operation ( & operation) . unwrap ( ) ;
312313
313- let best_before: Vec < _ > = mempool. get_top_operations ( 10 ) . collect ( ) ;
314+ let best_before: Vec < _ > = mempool. get_top_operations ( 10 ) ;
314315 assert_eq ! ( best_before. len( ) , 1 ) ;
315316 assert_eq ! ( best_before[ 0 ] . hash, hash) ;
316317
317318 let result = mempool. remove_operation ( & hash) ;
318319 assert ! ( result. is_ok( ) ) ;
319320 assert ! ( result. unwrap( ) . is_some( ) ) ;
320321
321- let best_after: Vec < _ > = mempool. get_top_operations ( 10 ) . collect ( ) ;
322+ let best_after: Vec < _ > = mempool. get_top_operations ( 10 ) ;
322323 assert_eq ! ( best_after. len( ) , 0 ) ;
323324 }
324325
@@ -338,7 +339,7 @@ mod tests {
338339 let operation3 = create_wrapped_operation ( 1500 , hash3) ;
339340 mempool. add_operation ( & operation3) . unwrap ( ) ;
340341
341- let best: Vec < _ > = mempool. get_top_operations ( 10 ) . collect ( ) ;
342+ let best: Vec < _ > = mempool. get_top_operations ( 10 ) ;
342343 assert_eq ! ( best. len( ) , 3 ) ;
343344 assert_eq ! ( best[ 0 ] . operation. max_fee_per_gas( ) , Uint :: from( 3000 ) ) ;
344345 assert_eq ! ( best[ 1 ] . operation. max_fee_per_gas( ) , Uint :: from( 2000 ) ) ;
@@ -361,7 +362,7 @@ mod tests {
361362 let operation3 = create_wrapped_operation ( 1500 , hash3) ;
362363 mempool. add_operation ( & operation3) . unwrap ( ) ;
363364
364- let best: Vec < _ > = mempool. get_top_operations ( 2 ) . collect ( ) ;
365+ let best: Vec < _ > = mempool. get_top_operations ( 2 ) ;
365366 assert_eq ! ( best. len( ) , 2 ) ;
366367 assert_eq ! ( best[ 0 ] . operation. max_fee_per_gas( ) , Uint :: from( 3000 ) ) ;
367368 assert_eq ! ( best[ 1 ] . operation. max_fee_per_gas( ) , Uint :: from( 2000 ) ) ;
@@ -379,7 +380,7 @@ mod tests {
379380 let operation2 = create_wrapped_operation ( 2000 , hash2) ;
380381 mempool. add_operation ( & operation2) . unwrap ( ) ;
381382
382- let best: Vec < _ > = mempool. get_top_operations ( 2 ) . collect ( ) ;
383+ let best: Vec < _ > = mempool. get_top_operations ( 2 ) ;
383384 assert_eq ! ( best. len( ) , 2 ) ;
384385 assert_eq ! ( best[ 0 ] . hash, hash1) ;
385386 assert_eq ! ( best[ 1 ] . hash, hash2) ;
@@ -417,7 +418,7 @@ mod tests {
417418 } ;
418419 mempool. add_operation ( & operation2) . unwrap ( ) ;
419420
420- let best: Vec < _ > = mempool. get_top_operations ( 2 ) . collect ( ) ;
421+ let best: Vec < _ > = mempool. get_top_operations ( 2 ) ;
421422 assert_eq ! ( best. len( ) , 1 ) ;
422423 assert_eq ! ( best[ 0 ] . operation. nonce( ) , Uint :: from( 0 ) ) ;
423424 }
0 commit comments