mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add blob costs to cost value (#4489)
This commit is contained in:
@ -1,6 +1,5 @@
|
||||
use crate::{
|
||||
compression::{TRANSACTION_COMPRESSOR, TRANSACTION_DECOMPRESSOR},
|
||||
constants::eip4844::DATA_GAS_PER_BLOB,
|
||||
keccak256, Address, Bytes, TxHash, H256,
|
||||
};
|
||||
pub use access_list::{AccessList, AccessListItem, AccessListWithGasUsed};
|
||||
@ -236,10 +235,10 @@ impl Transaction {
|
||||
/// Returns the blob gas used for all blobs of the EIP-4844 transaction if it is an EIP-4844
|
||||
/// transaction.
|
||||
///
|
||||
/// This is the number of blobs times the [DATA_GAS_PER_BLOB] a single blob consumes.
|
||||
pub fn blob_gas_used(&self) -> Option<u128> {
|
||||
let tx = self.as_eip4844()?;
|
||||
Some(tx.blob_versioned_hashes.len() as u128 * DATA_GAS_PER_BLOB as u128)
|
||||
/// This is the number of blobs times the
|
||||
/// [DATA_GAS_PER_BLOB](crate::constants::eip4844::DATA_GAS_PER_BLOB) a single blob consumes.
|
||||
pub fn blob_gas_used(&self) -> Option<u64> {
|
||||
self.as_eip4844().map(TxEip4844::blob_gas)
|
||||
}
|
||||
|
||||
/// Return the max priority fee per gas if the transaction is an EIP-1559 transaction, and
|
||||
|
||||
Reference in New Issue
Block a user