Remove awkward let
statement
This commit is contained in:
parent
8fb9e1f648
commit
82e8aafb01
@ -558,11 +558,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
// Attempt to process the attestation using the `self.head()` state.
|
||||
//
|
||||
// This is purely an effort to avoid loading a `BeaconState` unnecessarily from the DB.
|
||||
let optional_outcome: Option<Result<AttestationProcessingOutcome, Error>> = {
|
||||
// Take a read lock on the head beacon state.
|
||||
//
|
||||
// The purpose of this whole `let processed ...` block is to ensure that the read
|
||||
// lock is dropped if we don't end up using the head beacon state.
|
||||
let state = &self.head().beacon_state;
|
||||
|
||||
// If it turns out that the attestation was made using the head state, then there
|
||||
@ -585,20 +581,19 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
{
|
||||
// The head state is able to be used to validate this attestation. No need to load
|
||||
// anything from the database.
|
||||
Some(self.process_attestation_for_state_and_block(
|
||||
return self.process_attestation_for_state_and_block(
|
||||
attestation.clone(),
|
||||
state,
|
||||
&attestation_head_block,
|
||||
))
|
||||
} else {
|
||||
None
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
if let Some(outcome) = optional_outcome {
|
||||
// Verification was already completed with an in-memory state. Return that result.
|
||||
outcome
|
||||
} else {
|
||||
// Ensure the read-lock from `self.head()` is dropped.
|
||||
//
|
||||
// This is likely unnecessary, however it remains as a reminder to ensure this lock
|
||||
// isn't hogged.
|
||||
std::mem::drop(state);
|
||||
|
||||
// Use the `data.beacon_block_root` to load the state from the latest non-skipped
|
||||
// slot preceding the attestation's creation.
|
||||
//
|
||||
@ -649,7 +644,6 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
&attestation_head_block,
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Drop any attestation where we have not processed `attestation.data.beacon_block_root`.
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user