@@ -103,6 +103,8 @@ pub struct SortingData<Db> {
103103 /// We wait until these are back before we apply the next
104104 /// and send the next round of simulations
105105 pub in_flight_sims : usize ,
106+ /// Whether we should use fifo ordering instead of sorting by payments value.
107+ pub fifo_ordering : bool ,
106108 /// Remaining orders to be sorted, ideally with top of frag (TOF)
107109 /// sim data. The TOF sim data can be used as a heuristic initial sort of
108110 /// the orders. The assumption is that applying some orders will not
@@ -160,6 +162,7 @@ impl<Db: DatabaseRead> SortingData<Db> {
160162 gas_remaining : seq. gas_remaining ,
161163 da_config : data. config . da_config . clone ( ) ,
162164 da_remaining : seq. da_remaining ,
165+ fifo_ordering : data. config . fifo_ordering ,
163166 txs : vec ! [ ] ,
164167 start_t : Instant :: now ( ) ,
165168 telemetry : Default :: default ( ) ,
@@ -236,14 +239,15 @@ impl<Db> SortingData<Db> {
236239 ) ;
237240
238241 let tx_to_put_back = if simulated_tx. gas_used ( ) < self . gas_remaining &&
239- self . next_to_be_applied . as_ref ( ) . is_none_or ( |t| t. payment < simulated_tx. payment )
242+ self . next_to_be_applied . as_ref ( ) . is_none_or ( |t| t. payment < simulated_tx. payment ) &&
243+ !self . fifo_ordering
240244 {
241245 self . next_to_be_applied . replace ( simulated_tx)
242246 } else {
243247 Some ( simulated_tx)
244248 } ;
245249 if let Some ( tx) = tx_to_put_back {
246- self . tof_snapshot . put ( tx)
250+ self . tof_snapshot . put ( tx, self . fifo_ordering )
247251 }
248252 }
249253
0 commit comments