mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
refactor: store plain receipts instead Options in Receipts (#14010)
This commit is contained in:
@ -675,13 +675,7 @@ impl<N: NodePrimitives> BlockState<N> {
|
||||
receipts.receipt_vec.len()
|
||||
);
|
||||
|
||||
receipts
|
||||
.receipt_vec
|
||||
.first()
|
||||
.map(|block_receipts| {
|
||||
block_receipts.iter().filter_map(|opt_receipt| opt_receipt.clone()).collect()
|
||||
})
|
||||
.unwrap_or_default()
|
||||
receipts.receipt_vec.first().cloned().unwrap_or_default()
|
||||
}
|
||||
|
||||
/// Returns a vector of __parent__ `BlockStates`.
|
||||
@ -1272,7 +1266,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_state_receipts() {
|
||||
let receipts = Receipts { receipt_vec: vec![vec![Some(Receipt::default())]] };
|
||||
let receipts = Receipts { receipt_vec: vec![vec![Receipt::default()]] };
|
||||
let mut test_block_builder: TestBlockBuilder = TestBlockBuilder::default();
|
||||
let block =
|
||||
test_block_builder.get_executed_block_with_receipts(receipts.clone(), B256::random());
|
||||
|
||||
@ -334,7 +334,7 @@ mod tests {
|
||||
};
|
||||
|
||||
// Wrap the receipt in a `Receipts` structure, as expected in the `ExecutionOutcome`.
|
||||
let receipts = Receipts { receipt_vec: vec![vec![Some(receipt1.clone())]] };
|
||||
let receipts = Receipts { receipt_vec: vec![vec![receipt1.clone()]] };
|
||||
|
||||
// Define an `ExecutionOutcome` with the created receipts.
|
||||
let execution_outcome = ExecutionOutcome { receipts, ..Default::default() };
|
||||
@ -393,7 +393,7 @@ mod tests {
|
||||
success: false,
|
||||
..Default::default()
|
||||
};
|
||||
let old_receipts = Receipts { receipt_vec: vec![vec![Some(old_receipt.clone())]] };
|
||||
let old_receipts = Receipts { receipt_vec: vec![vec![old_receipt.clone()]] };
|
||||
|
||||
let old_execution_outcome =
|
||||
ExecutionOutcome { receipts: old_receipts, ..Default::default() };
|
||||
@ -424,7 +424,7 @@ mod tests {
|
||||
success: true,
|
||||
..Default::default()
|
||||
};
|
||||
let new_receipts = Receipts { receipt_vec: vec![vec![Some(new_receipt.clone())]] };
|
||||
let new_receipts = Receipts { receipt_vec: vec![vec![new_receipt.clone()]] };
|
||||
|
||||
let new_execution_outcome =
|
||||
ExecutionOutcome { receipts: new_receipts, ..Default::default() };
|
||||
|
||||
@ -296,7 +296,7 @@ impl<N: NodePrimitives> TestBlockBuilder<N> {
|
||||
|
||||
let execution_outcome = ExecutionOutcome::new(
|
||||
bundle_state_builder.build(),
|
||||
vec![vec![None]].into(),
|
||||
vec![vec![]].into(),
|
||||
block.number,
|
||||
Vec::new(),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user