@@ -289,38 +289,15 @@ impl BundleDatastore for PostgresDatastore {
289289
290290 if let Some ( existing_bundle) = existing_bundle {
291291 let bundle_id = existing_bundle. id ;
292- let bundle_with_metadata = self . row_to_bundle_with_metadata ( existing_bundle) ?;
292+ let existing_bundle_with_metadata =
293+ self . row_to_bundle_with_metadata ( existing_bundle) ?;
293294
294295 // make sure bundle hash is the same. the assumption is that since the bundle_hash is the same,
295296 // all fields related to txs remain unchanged (i.e., txs, txn_hashes, reverting_tx_hashes, dropping_tx_hashes)
296- if bundle_with_metadata. bundle . bundle_hash ( ) == bundle. bundle_hash ( ) {
297- let existing_bundle = & bundle_with_metadata. bundle ;
298-
299- // use the higher minimum_base_fee if available
300- let combined_minimum_base_fee =
301- Some ( bundle_with_metadata. min_base_fee . max ( minimum_base_fee) ) ;
302-
303- // use the more restrictive block_number (higher value)
304- let combined_block_number = existing_bundle. block_number . max ( bundle. block_number ) ;
305-
306- // use the more restrictive min_timestamp (higher value if both specified)
307- let combined_min_timestamp =
308- match ( existing_bundle. min_timestamp , bundle. min_timestamp ) {
309- ( Some ( existing) , Some ( new) ) => Some ( existing. max ( new) ) ,
310- ( Some ( existing) , None ) => Some ( existing) ,
311- ( None , Some ( new) ) => Some ( new) ,
312- ( None , None ) => None ,
313- } ;
314-
315- // use the more restrictive max_timestamp (lower value if both specified)
316- let combined_max_timestamp =
317- match ( existing_bundle. max_timestamp , bundle. max_timestamp ) {
318- ( Some ( existing) , Some ( new) ) => Some ( existing. min ( new) ) ,
319- ( Some ( existing) , None ) => Some ( existing) ,
320- ( None , Some ( new) ) => Some ( new) ,
321- ( None , None ) => None ,
322- } ;
297+ if existing_bundle_with_metadata. bundle . bundle_hash ( ) == bundle. bundle_hash ( ) {
298+ let ( _, min_base_fee, _) = self . extract_bundle_metadata ( & bundle) ?;
323299
300+ // for now, we naively update with the latest bundle values
324301 sqlx:: query!(
325302 r#"
326303 UPDATE bundles
@@ -330,10 +307,10 @@ impl BundleDatastore for PostgresDatastore {
330307 WHERE id = $6
331308 "# ,
332309 BundleState :: Ready as BundleState ,
333- combined_minimum_base_fee ,
334- combined_block_number as i64 ,
335- combined_min_timestamp . map( |t| t as i64 ) ,
336- combined_max_timestamp . map( |t| t as i64 ) ,
310+ min_base_fee ,
311+ bundle . block_number as i64 ,
312+ bundle . min_timestamp . map( |t| t as i64 ) ,
313+ bundle . max_timestamp . map( |t| t as i64 ) ,
337314 bundle_id. clone( )
338315 )
339316 . execute ( & self . pool )
0 commit comments