mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-20 22:38:34 +00:00
O(n) children index, fix load_parent for gloas blocks
- Build parent->children index once per find_head call, replacing O(n) scans in filter_block_tree and get_node_children with O(1) lookups. - Skip zero block_hash in is_parent_block_full check — default/zero hashes don't indicate a real payload relationship. - Fall back to block state_root for genesis when envelope not stored. - Store execution payload envelope in EF test harness during on_execution_payload step.
This commit is contained in:
@@ -449,8 +449,7 @@ impl<E: EthSpec> Case for ForkChoiceTest<E> {
|
||||
execution_payload,
|
||||
valid,
|
||||
} => {
|
||||
tester
|
||||
.process_execution_payload(execution_payload.beacon_block_root(), *valid)?;
|
||||
tester.process_execution_payload(execution_payload, *valid)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -993,7 +992,27 @@ impl<E: EthSpec> Tester<E> {
|
||||
check_equal("proposer_head", proposer_head, expected_proposer_head)
|
||||
}
|
||||
|
||||
pub fn process_execution_payload(&self, block_root: Hash256, valid: bool) -> Result<(), Error> {
|
||||
pub fn process_execution_payload(
|
||||
&self,
|
||||
signed_envelope: &SignedExecutionPayloadEnvelope<E>,
|
||||
valid: bool,
|
||||
) -> Result<(), Error> {
|
||||
let block_root = signed_envelope.message.beacon_block_root;
|
||||
|
||||
// Store the envelope in the database so that child blocks extending
|
||||
// the FULL path can load the parent's post-payload state.
|
||||
if valid {
|
||||
self.harness
|
||||
.chain
|
||||
.store
|
||||
.put_payload_envelope(&block_root, signed_envelope.clone())
|
||||
.map_err(|e| {
|
||||
Error::InternalError(format!(
|
||||
"Failed to store payload envelope for {block_root:?}: {e:?}",
|
||||
))
|
||||
})?;
|
||||
}
|
||||
|
||||
let result = self
|
||||
.harness
|
||||
.chain
|
||||
|
||||
Reference in New Issue
Block a user