mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix(payload): sum cumulative gas used before adding receipt (#2284)
This commit is contained in:
@ -477,10 +477,14 @@ fn build_payload<Pool, Client>(
|
||||
// TODO skip invalid transactions
|
||||
let ResultAndState { result, state } =
|
||||
evm.transact().map_err(PayloadBuilderError::EvmExecutionError)?;
|
||||
let gas_used = result.gas_used();
|
||||
|
||||
// commit changes
|
||||
commit_state_changes(&mut db, &mut post_state, state, true);
|
||||
|
||||
// add gas used by the transaction to cumulative gas used, before creating the receipt
|
||||
cumulative_gas_used += gas_used;
|
||||
|
||||
// Push transaction changeset and calculate header bloom filter for receipt.
|
||||
post_state.add_receipt(Receipt {
|
||||
tx_type: tx.tx_type(),
|
||||
@ -489,17 +493,12 @@ fn build_payload<Pool, Client>(
|
||||
logs: result.logs().into_iter().map(into_reth_log).collect(),
|
||||
});
|
||||
|
||||
let gas_used = result.gas_used();
|
||||
|
||||
// update add to total fees
|
||||
let miner_fee = tx
|
||||
.effective_tip_per_gas(base_fee)
|
||||
.expect("fee is always valid; execution succeeded");
|
||||
total_fees += U256::from(miner_fee) * U256::from(gas_used);
|
||||
|
||||
// append gas used
|
||||
cumulative_gas_used += gas_used;
|
||||
|
||||
// append transaction to the list of executed transactions
|
||||
executed_txs.push(tx.into_signed());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user