@@ -7,11 +7,14 @@ use super::{
77 TransactionPoolError ,
88} ;
99
10- use crate :: verification:: { PackingCheckResult , VerificationConfig } ;
10+ use crate :: verification:: PackingCheckResult ;
1111use cfx_executor:: machine:: Machine ;
1212use cfx_packing_pool:: PackingPoolConfig ;
1313use cfx_parameters:: {
14- block:: cspace_block_gas_limit_after_cip1559,
14+ block:: {
15+ cspace_block_gas_limit_after_cip1559,
16+ espace_block_gas_limit_of_enabled_block,
17+ } ,
1518 consensus_internal:: ELASTICITY_MULTIPLIER ,
1619 staking:: DRIPS_PER_STORAGE_COLLATERAL_UNIT ,
1720} ;
@@ -643,35 +646,22 @@ impl TransactionPoolInner {
643646 /// pack at most num_txs transactions randomly
644647 pub fn pack_transactions < ' a > (
645648 & mut self , num_txs : usize , block_gas_limit : U256 , evm_gas_limit : U256 ,
646- block_size_limit : usize , best_epoch_height : u64 ,
647- best_block_number : u64 , verification_config : & VerificationConfig ,
648- machine : & Machine ,
649+ block_size_limit : usize ,
650+ validity : impl Fn ( & SignedTransaction ) -> PackingCheckResult ,
649651 ) -> Vec < Arc < SignedTransaction > > {
650652 let mut packed_transactions: Vec < Arc < SignedTransaction > > = Vec :: new ( ) ;
651653 if num_txs == 0 {
652654 return packed_transactions;
653655 }
654656
655- let spec = machine. spec ( best_block_number, best_epoch_height) ;
656- let transitions = & machine. params ( ) . transition_heights ;
657-
658- let validity = |tx : & SignedTransaction | {
659- verification_config. fast_recheck (
660- tx,
661- best_epoch_height,
662- transitions,
663- & spec,
664- )
665- } ;
666-
667657 let ( sampled_tx, used_gas, used_size) =
668658 self . deferred_pool . packing_sampler (
669659 Space :: Ethereum ,
670660 std:: cmp:: min ( block_gas_limit, evm_gas_limit) ,
671661 block_size_limit,
672662 num_txs,
673663 U256 :: zero ( ) ,
674- validity,
664+ & validity,
675665 ) ;
676666 packed_transactions. extend_from_slice ( & sampled_tx) ;
677667
@@ -681,7 +671,7 @@ impl TransactionPoolInner {
681671 block_size_limit - used_size,
682672 num_txs - sampled_tx. len ( ) ,
683673 U256 :: zero ( ) ,
684- validity,
674+ & validity,
685675 ) ;
686676 packed_transactions. extend_from_slice ( & sampled_tx) ;
687677
@@ -722,7 +712,9 @@ impl TransactionPoolInner {
722712 machine. params ( ) . can_pack_evm_transaction ( best_epoch_height) ;
723713
724714 let ( evm_packed_tx_num, evm_used_size) = if can_pack_evm {
725- let gas_target = block_gas_limit * 5 / 10 / ELASTICITY_MULTIPLIER ;
715+ let gas_target =
716+ espace_block_gas_limit_of_enabled_block ( block_gas_limit)
717+ / ELASTICITY_MULTIPLIER ;
726718 let parent_base_price = parent_base_price[ Space :: Ethereum ] ;
727719 let min_base_price =
728720 machine. params ( ) . min_base_price ( ) [ Space :: Ethereum ] ;
0 commit comments