mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
fix(poststate): duplicate receipts (#2632)
This commit is contained in:
@ -223,7 +223,7 @@ where
|
||||
self.init_env(&block.header, total_difficulty);
|
||||
|
||||
let mut cumulative_gas_used = 0;
|
||||
let mut post_state = PostState::with_tx_capacity(block.body.len());
|
||||
let mut post_state = PostState::with_tx_capacity(block.number, block.body.len());
|
||||
for (transaction, sender) in block.body.iter().zip(senders.into_iter()) {
|
||||
// The sum of the transaction’s gas limit, Tg, and the gas utilised in this block prior,
|
||||
// must be no greater than the block’s gasLimit.
|
||||
@ -249,15 +249,18 @@ where
|
||||
cumulative_gas_used += result.gas_used();
|
||||
|
||||
// Push transaction changeset and calculate header bloom filter for receipt.
|
||||
post_state.add_receipt(Receipt {
|
||||
tx_type: transaction.tx_type(),
|
||||
// Success flag was added in `EIP-658: Embedding transaction status code in
|
||||
// receipts`.
|
||||
success: result.is_success(),
|
||||
cumulative_gas_used,
|
||||
// convert to reth log
|
||||
logs: result.into_logs().into_iter().map(into_reth_log).collect(),
|
||||
});
|
||||
post_state.add_receipt(
|
||||
block.number,
|
||||
Receipt {
|
||||
tx_type: transaction.tx_type(),
|
||||
// Success flag was added in `EIP-658: Embedding transaction status code in
|
||||
// receipts`.
|
||||
success: result.is_success(),
|
||||
cumulative_gas_used,
|
||||
// convert to reth log
|
||||
logs: result.into_logs().into_iter().map(into_reth_log).collect(),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Ok((post_state, cumulative_gas_used))
|
||||
@ -311,7 +314,7 @@ where
|
||||
verify_receipt(
|
||||
block.header.receipts_root,
|
||||
block.header.logs_bloom,
|
||||
post_state.receipts().iter(),
|
||||
post_state.receipts(block.number).iter(),
|
||||
)?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user