feat: add block timestamp to meta (#7460)

This commit is contained in:
Matthias Seitz
2024-04-04 16:46:20 +02:00
committed by GitHub
parent 9c11961488
commit ca82ff5be6
5 changed files with 7 additions and 1 deletions

View File

@ -15,4 +15,6 @@ pub struct TransactionMeta {
pub base_fee: Option<u64>,
/// The excess blob gas of the block.
pub excess_blob_gas: Option<u64>,
/// The block's timestamp.
pub timestamp: u64,
}

View File

@ -79,6 +79,7 @@ where
let base_fee = block.base_fee_per_gas;
let block_hash = block.hash();
let excess_blob_gas = block.excess_blob_gas;
let timestamp = block.timestamp;
let block = block.unseal();
#[cfg(feature = "optimism")]
@ -100,6 +101,7 @@ where
block_number,
base_fee,
excess_blob_gas,
timestamp,
};
#[cfg(feature = "optimism")]

View File

@ -1741,7 +1741,7 @@ pub(crate) fn build_transaction_receipt_with_block_receipts(
inner: log.into(),
block_hash: Some(meta.block_hash),
block_number: Some(meta.block_number),
block_timestamp: None,
block_timestamp: Some(meta.timestamp),
transaction_hash: Some(meta.tx_hash),
transaction_index: Some(meta.index),
log_index: Some((num_logs + tx_log_idx) as u64),

View File

@ -1608,6 +1608,7 @@ impl<TX: DbTx> TransactionsProvider for DatabaseProvider<TX> {
block_number,
base_fee: header.base_fee_per_gas,
excess_blob_gas: header.excess_blob_gas,
timestamp: header.timestamp,
};
return Ok(Some((transaction, meta)))

View File

@ -247,6 +247,7 @@ impl TransactionsProvider for MockEthProvider {
block_number: block.header.number,
base_fee: block.header.base_fee_per_gas,
excess_blob_gas: block.header.excess_blob_gas,
timestamp: block.header.timestamp,
};
return Ok(Some((tx.clone(), meta)))
}