mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
Fix ups and Clippy
This commit is contained in:
@@ -3456,7 +3456,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
};
|
||||
let (state, state_root_opt) = if head_slot < slot {
|
||||
// Attempt an aggressive re-org if configured and the conditions are right.
|
||||
if let Some(re_org_state) = self.get_state_for_re_org(slot, head_slot, head_block_root)
|
||||
if let Some((re_org_state, re_org_state_root)) =
|
||||
self.get_state_for_re_org(slot, head_slot, head_block_root)
|
||||
{
|
||||
info!(
|
||||
self.log,
|
||||
@@ -3464,7 +3465,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
"slot" => slot,
|
||||
"head_to_reorg" => %head_block_root,
|
||||
);
|
||||
(re_org_state.pre_state, re_org_state.state_root)
|
||||
(re_org_state, Some(re_org_state_root))
|
||||
} else {
|
||||
// Fetch the head state advanced through to `slot`, which should be present in the
|
||||
// state cache thanks to the state advance timer.
|
||||
@@ -3594,7 +3595,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
"Error loading block production state";
|
||||
"error" => ?e,
|
||||
);
|
||||
)
|
||||
})
|
||||
.ok()??;
|
||||
|
||||
info!(
|
||||
|
||||
@@ -192,11 +192,7 @@ where
|
||||
balances_cache: <_>::default(),
|
||||
time: anchor_state.slot(),
|
||||
justified_checkpoint,
|
||||
<<<<<<< HEAD
|
||||
justified_balances: anchor_state.balances().to_vec(),
|
||||
=======
|
||||
justified_balances,
|
||||
>>>>>>> origin/unstable
|
||||
finalized_checkpoint,
|
||||
best_justified_checkpoint: justified_checkpoint,
|
||||
unrealized_justified_checkpoint: justified_checkpoint,
|
||||
|
||||
@@ -530,7 +530,7 @@ pub fn signature_verify_chain_segment<T: BeaconChainTypes>(
|
||||
}
|
||||
|
||||
let (first_root, first_block) = chain_segment.remove(0);
|
||||
let (mut parent, first_block) = load_parent(first_root, first_block, chain)?;
|
||||
let (mut parent, first_block) = load_parent(first_block, chain)?;
|
||||
let slot = first_block.slot();
|
||||
chain_segment.insert(0, (first_root, first_block));
|
||||
|
||||
@@ -795,7 +795,7 @@ impl<T: BeaconChainTypes> GossipVerifiedBlock<T> {
|
||||
} else {
|
||||
// The proposer index was *not* cached and we must load the parent in order to determine
|
||||
// the proposer index.
|
||||
let (mut parent, block) = load_parent(block_root, block, chain)?;
|
||||
let (mut parent, block) = load_parent(block, chain)?;
|
||||
|
||||
debug!(
|
||||
chain.log,
|
||||
@@ -933,7 +933,7 @@ impl<T: BeaconChainTypes> SignatureVerifiedBlock<T> {
|
||||
// Check the anchor slot before loading the parent, to avoid spurious lookups.
|
||||
check_block_against_anchor_slot(block.message(), chain)?;
|
||||
|
||||
let (mut parent, block) = load_parent(block_root, block, chain)?;
|
||||
let (mut parent, block) = load_parent(block, chain)?;
|
||||
|
||||
// Reject any block that exceeds our limit on skipped slots.
|
||||
check_block_skip_slots(chain, parent.beacon_block.slot(), block.message())?;
|
||||
@@ -986,7 +986,7 @@ impl<T: BeaconChainTypes> SignatureVerifiedBlock<T> {
|
||||
let (mut parent, block) = if let Some(parent) = from.parent {
|
||||
(parent, from.block)
|
||||
} else {
|
||||
load_parent(from.block_root, from.block, chain)?
|
||||
load_parent(from.block, chain)?
|
||||
};
|
||||
|
||||
let state = cheap_state_advance_to_obtain_committees(
|
||||
@@ -1046,7 +1046,7 @@ impl<T: BeaconChainTypes> IntoExecutionPendingBlock<T> for SignatureVerifiedBloc
|
||||
let (parent, block) = if let Some(parent) = self.parent {
|
||||
(parent, self.block)
|
||||
} else {
|
||||
load_parent(self.block_root, self.block, chain)
|
||||
load_parent(self.block, chain)
|
||||
.map_err(|e| BlockSlashInfo::SignatureValid(header.clone(), e))?
|
||||
};
|
||||
|
||||
@@ -1655,7 +1655,6 @@ fn verify_parent_block_is_known<T: BeaconChainTypes>(
|
||||
/// whilst attempting the operation.
|
||||
#[allow(clippy::type_complexity)]
|
||||
fn load_parent<T: BeaconChainTypes>(
|
||||
block_root: Hash256,
|
||||
block: Arc<SignedBeaconBlock<T::EthSpec>>,
|
||||
chain: &BeaconChain<T>,
|
||||
) -> Result<
|
||||
|
||||
Reference in New Issue
Block a user