fix: receipt for non EIP-4844 transactions (#7129)

This commit is contained in:
greged93
2024-03-13 13:40:04 +01:00
committed by GitHub
parent 8fbab739c8
commit c9c269b64f

View File

@@ -1507,6 +1507,11 @@ pub(crate) fn build_transaction_receipt_with_block_receipts(
.unwrap_or_default()
};
let blob_gas_used = transaction.transaction.blob_gas_used().map(U128::from);
// Blob gas price should only be present if the transaction is a blob transaction
let blob_gas_price =
blob_gas_used.and_then(|_| meta.excess_blob_gas.map(calc_blob_gasprice).map(U128::from));
#[allow(clippy::needless_update)]
let mut res_receipt = TransactionReceipt {
transaction_hash: Some(meta.tx_hash),
@@ -1526,8 +1531,8 @@ pub(crate) fn build_transaction_receipt_with_block_receipts(
logs_bloom: receipt.bloom_slow(),
status_code: if receipt.success { Some(U64::from(1)) } else { Some(U64::from(0)) },
// EIP-4844 fields
blob_gas_price: meta.excess_blob_gas.map(calc_blob_gasprice).map(U128::from),
blob_gas_used: transaction.transaction.blob_gas_used().map(U128::from),
blob_gas_price,
blob_gas_used,
..Default::default()
};