Implicit conflicts resolved.
This commit is contained in:
parent
d11839c392
commit
c431bd993e
@ -520,8 +520,8 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
|
||||
if let Some(state) = self.get_attestation_state(&attestation) {
|
||||
if self.fork_choice.should_process_attestation(&state, &attestation)? {
|
||||
let indexed_attestation = common::convert_to_indexed(&state, &attestation)?;
|
||||
per_block_processing::verify_indexed_attestation(&state, &indexed_attestation, &self.spec)?;
|
||||
let indexed_attestation = common::get_indexed_attestation(&state, &attestation)?;
|
||||
per_block_processing::is_valid_indexed_attestation(&state, &indexed_attestation, &self.spec)?;
|
||||
self.fork_choice.process_attestation(&state, &attestation)?;
|
||||
}
|
||||
}
|
||||
@ -540,14 +540,14 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
}
|
||||
|
||||
/// Retrieves the `BeaconState` used to create the attestation.
|
||||
fn get_attestation_state(&self, attestation: &Attestation) -> Option<BeaconState<T::EthSpec>> {
|
||||
fn get_attestation_state(&self, attestation: &Attestation<T::EthSpec>) -> Option<BeaconState<T::EthSpec>> {
|
||||
// Current state is used if the attestation targets a historic block and a slot within an
|
||||
// equal or adjacent epoch.
|
||||
let slots_per_epoch = T::EthSpec::slots_per_epoch();
|
||||
let min_slot = (self.state.read().slot.epoch(slots_per_epoch) - 1).start_slot(slots_per_epoch);
|
||||
let blocks = BestBlockRootsIterator::owned(self.store.clone(), self.state.read().clone(), self.state.read().slot.clone());
|
||||
for (root, slot) in blocks {
|
||||
if root == attestation.data.target_root {
|
||||
if root == attestation.data.target.root {
|
||||
return Some(self.state.read().clone());
|
||||
}
|
||||
|
||||
@ -557,7 +557,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
||||
};
|
||||
|
||||
// A different state is retrieved from the database.
|
||||
match self.store.get::<BeaconBlock>(&attestation.data.target_root) {
|
||||
match self.store.get::<BeaconBlock<T::EthSpec>>(&attestation.data.target.root) {
|
||||
Ok(Some(block)) => match self.store.get::<BeaconState<T::EthSpec>>(&block.state_root) {
|
||||
Ok(state) => state,
|
||||
_ => None
|
||||
|
@ -4,7 +4,6 @@ use state_processing::common::get_attesting_indices;
|
||||
use std::sync::Arc;
|
||||
use store::{Error as StoreError, Store};
|
||||
use types::{Attestation, BeaconBlock, BeaconState, BeaconStateError, Epoch, EthSpec, Hash256, Slot};
|
||||
use state_processing::common;
|
||||
|
||||
type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
@ -172,14 +171,11 @@ impl<T: BeaconChainTypes> ForkChoice<T> {
|
||||
}
|
||||
|
||||
/// Determines whether or not the given attestation contains a latest message.
|
||||
pub fn should_process_attestation(&self, state: &BeaconState<T::EthSpec>, attestation: &Attestation) -> Result<bool> {
|
||||
let validator_indices = common::get_attesting_indices_unsorted(
|
||||
state,
|
||||
&attestation.data,
|
||||
&attestation.aggregation_bitfield,
|
||||
)?;
|
||||
pub fn should_process_attestation(&self, state: &BeaconState<T::EthSpec>, attestation: &Attestation<T::EthSpec>) -> Result<bool> {
|
||||
let validator_indices =
|
||||
get_attesting_indices(state, &attestation.data, &attestation.aggregation_bits)?;
|
||||
|
||||
let block_slot = state.get_attestation_slot(&attestation.data)?;
|
||||
let block_slot = state.get_attestation_data_slot(&attestation.data)?;
|
||||
|
||||
Ok(validator_indices
|
||||
.iter()
|
||||
|
@ -1,3 +1,4 @@
|
||||
#![cfg(not(debug_assertions))]
|
||||
|
||||
use beacon_chain::test_utils::{
|
||||
AttestationStrategy, BeaconChainHarness, BlockStrategy, CommonTypes, PersistedBeaconChain,
|
||||
|
Loading…
Reference in New Issue
Block a user