fixing recursive calls with caching

This commit is contained in:
hopinheimer
2026-03-20 16:10:43 -04:00
parent ab1305d490
commit cc8466dfa5
6 changed files with 488 additions and 60 deletions

View File

@@ -4845,22 +4845,21 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
// get_attestation_score(parent, parent_payload_status) where parent_payload_status
// is determined by the head block's relationship to its parent.
let head_weight = info.head_node.weight();
let parent_weight =
if let (Ok(head_payload_status), Ok(parent_v29)) = (
info.head_node.parent_payload_status(),
info.parent_node.as_v29(),
) {
// Post-GLOAS: use the payload-filtered weight matching how the head
// extends from its parent.
match head_payload_status {
proto_array::PayloadStatus::Full => parent_v29.full_payload_weight,
proto_array::PayloadStatus::Empty => parent_v29.empty_payload_weight,
proto_array::PayloadStatus::Pending => info.parent_node.weight(),
}
} else {
// Pre-GLOAS or fork boundary: use total weight.
info.parent_node.weight()
};
let parent_weight = if let (Ok(head_payload_status), Ok(parent_v29)) = (
info.head_node.parent_payload_status(),
info.parent_node.as_v29(),
) {
// Post-GLOAS: use the payload-filtered weight matching how the head
// extends from its parent.
match head_payload_status {
proto_array::PayloadStatus::Full => parent_v29.full_payload_weight,
proto_array::PayloadStatus::Empty => parent_v29.empty_payload_weight,
proto_array::PayloadStatus::Pending => info.parent_node.weight(),
}
} else {
// Pre-GLOAS or fork boundary: use total weight.
info.parent_node.weight()
};
let (head_weak, parent_strong) = if fork_choice_slot == re_org_block_slot {
(