File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
crates/rbuilder/src/building Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -1301,17 +1301,18 @@ pub fn create_sim_value(
13011301 // We don't filter for mempool txs.
13021302 order_ok. coinbase_profit
13031303 } else {
1304- let non_mempool_coinbase_profit = order_ok
1304+ let mempool_coinbase_profit = order_ok
13051305 . tx_infos
13061306 . iter ( )
1307- . filter ( |tx_info| ! mempool_detector. is_mempool ( & tx_info. tx ) )
1307+ . filter ( |tx_info| mempool_detector. is_mempool ( & tx_info. tx ) )
13081308 . map ( |tx_info| tx_info. coinbase_profit )
13091309 . sum :: < I256 > ( ) ;
1310- if non_mempool_coinbase_profit. is_zero ( ) || non_mempool_coinbase_profit. is_positive ( ) {
1311- non_mempool_coinbase_profit. unsigned_abs ( )
1310+ if mempool_coinbase_profit. is_positive ( ) {
1311+ order_ok
1312+ . coinbase_profit
1313+ . saturating_sub ( mempool_coinbase_profit. unsigned_abs ( ) )
13121314 } else {
1313- // This could be a bundle which was positive thanks to the inclusion of mempool txs.
1314- U256 :: ZERO
1315+ order_ok. coinbase_profit
13151316 }
13161317 } ;
13171318
@@ -1345,7 +1346,7 @@ mod test {
13451346 let profit_1 = I256 :: unchecked_from ( 1000 ) ;
13461347 let profit_2 = I256 :: unchecked_from ( 10000 ) ;
13471348 let order_ok = OrderOk {
1348- coinbase_profit : Default :: default ( ) ,
1349+ coinbase_profit : ( profit_1 + profit_2 ) . unsigned_abs ( ) ,
13491350 space_used : Default :: default ( ) ,
13501351 cumulative_space_used : Default :: default ( ) ,
13511352 tx_infos : vec ! [
You can’t perform that action at this time.
0 commit comments