@@ -47,9 +47,6 @@ struct EvmTxPreApplyContext {
4747 std::multimap<uint64_t , CTxMemPool::txiter>& failedNonces;
4848 std::map<uint256, CTxMemPool::FailedNonceIterator>& failedNoncesLookup;
4949 CTxMemPool::setEntries& failedTxEntries;
50- arith_uint256& sortedGasUsed;
51- arith_uint256& blockGasUsed;
52- arith_uint256& blockGasLimit;
5350};
5451
5552int64_t UpdateTime (CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev)
@@ -627,9 +624,6 @@ bool BlockAssembler::EvmTxPreapply(EvmTxPreApplyContext& ctx)
627624 auto & failedNonces = ctx.failedNonces ;
628625 auto & failedNoncesLookup = ctx.failedNoncesLookup ;
629626 auto & [txNonce, txSender] = txIter->GetEVMAddrAndNonce ();
630- const auto & sortedGasUsed = ctx.sortedGasUsed ;
631- const auto & blockGasUsed = ctx.blockGasUsed ;
632- const auto & blockGasLimit = ctx.blockGasLimit ;
633627
634628 CrossBoundaryResult result;
635629 const auto expectedNonce = evm_try_unsafe_get_next_valid_nonce_in_q (result, evmQueueId, txSender);
@@ -647,10 +641,6 @@ bool BlockAssembler::EvmTxPreapply(EvmTxPreApplyContext& ctx)
647641 return false ;
648642 }
649643
650- if (blockGasUsed + sortedGasUsed + txIter->GetEVMGasUsed () > blockGasLimit) {
651- return false ;
652- }
653-
654644 return true ;
655645}
656646
@@ -699,16 +689,6 @@ void BlockAssembler::addPackageTxs(int& nPackagesSelected, int& nDescendantsUpda
699689 std::map<uint256, CTxMemPool::FailedNonceIterator> failedNoncesLookup;
700690
701691 // Block gas limit
702- CrossBoundaryResult result;
703- auto blockGasLimitInt = evm_try_get_block_limit (result);
704- if (!result.ok ) {
705- blockGasLimitInt = DEFAULT_EVM_BLOCK_GAS_LIMIT;
706- }
707- arith_uint256 blockGasLimit{blockGasLimitInt};
708-
709- // Gas used in the block
710- arith_uint256 blockGasUsed{};
711-
712692 while (mi != mempool.mapTx .get <T>().end () || !mapModifiedTxSet.empty () || !failedNonces.empty ()) {
713693 // First try to find a new transaction in mapTx to evaluate.
714694 if (mi != mempool.mapTx .get <T>().end () &&
@@ -819,9 +799,6 @@ void BlockAssembler::addPackageTxs(int& nPackagesSelected, int& nDescendantsUpda
819799 // Track failed custom TX. Used for removing EVM TXs from the queue.
820800 uint256 failedCustomTx;
821801
822- // Gas used for the sorted entries
823- arith_uint256 sortedGasUsed{};
824-
825802 // Apply and check custom TXs in order
826803 for (const auto & entry : sortedEntries) {
827804 const CTransaction& tx = entry->GetTx ();
@@ -855,9 +832,6 @@ void BlockAssembler::addPackageTxs(int& nPackagesSelected, int& nDescendantsUpda
855832 failedNonces,
856833 failedNoncesLookup,
857834 failedTxSet,
858- sortedGasUsed,
859- blockGasUsed,
860- blockGasLimit,
861835 };
862836 auto res = EvmTxPreapply (evmTxCtx);
863837 if (res) {
@@ -880,15 +854,6 @@ void BlockAssembler::addPackageTxs(int& nPackagesSelected, int& nDescendantsUpda
880854 break ;
881855 }
882856
883- if (evmType) {
884- const auto totalGas = evm_try_unsafe_get_total_gas_used (result, evmQueueId);
885- if (!result.ok ) {
886- LogPrintf (" Failed to get total gas used in queue %d\n " , evmQueueId);
887- } else {
888- sortedGasUsed = UintToArith256 (uint256S ({totalGas.begin (), totalGas.end ()}));
889- }
890- }
891-
892857 // Track checked TXs to avoid double applying
893858 checkedDfTxHashSet.insert (tx.GetHash ());
894859 }
@@ -919,6 +884,7 @@ void BlockAssembler::addPackageTxs(int& nPackagesSelected, int& nDescendantsUpda
919884 // If the first TX in a failed set is not the failed TX
920885 // then remove from queue, otherwise it has not been added.
921886 if (entryHash != failedCustomTx) {
887+ CrossBoundaryResult result;
922888 evm_try_unsafe_remove_txs_above_hash_in_q (result, evmQueueId, entryHash.ToString ());
923889 if (!result.ok ) {
924890 LogPrintf (" %s: Unable to remove %s from queue. Will result in a block hash mismatch.\n " , __func__, entryHash.ToString ());
@@ -938,9 +904,6 @@ void BlockAssembler::addPackageTxs(int& nPackagesSelected, int& nDescendantsUpda
938904 cache.Flush ();
939905 coinsCache.Flush ();
940906
941- // Set block gas used to sorted gas used
942- blockGasUsed = sortedGasUsed;
943-
944907 for (const auto & entry : sortedEntries) {
945908 auto & hash = entry->GetTx ().GetHash ();
946909 if (failedNoncesLookup.count (hash)) {
0 commit comments