mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
Integration tests for free attestation processing
This commit is contained in:
@@ -3,7 +3,7 @@ use lmd_ghost::LmdGhost;
|
||||
use state_processing::common::get_attesting_indices_unsorted;
|
||||
use std::sync::Arc;
|
||||
use store::{Error as StoreError, Store};
|
||||
use types::{Attestation, BeaconBlock, BeaconState, BeaconStateError, Epoch, EthSpec, Hash256};
|
||||
use types::{Attestation, BeaconBlock, BeaconState, BeaconStateError, Epoch, EthSpec, Hash256, Slot};
|
||||
use state_processing::common;
|
||||
|
||||
type Result<T> = std::result::Result<T, Error>;
|
||||
@@ -186,6 +186,11 @@ impl<T: BeaconChainTypes> ForkChoice<T> {
|
||||
}).is_some())
|
||||
}
|
||||
|
||||
// Returns the latest message for a given validator
|
||||
pub fn latest_message(&self, validator_index: usize) -> Option<(Hash256, Slot)> {
|
||||
self.backend.latest_message(validator_index)
|
||||
}
|
||||
|
||||
/// Inform the fork choice that the given block (and corresponding root) have been finalized so
|
||||
/// it may prune it's storage.
|
||||
///
|
||||
|
||||
@@ -171,7 +171,7 @@ where
|
||||
if let BlockProcessingOutcome::Processed { block_root } = outcome {
|
||||
head_block_root = Some(block_root);
|
||||
|
||||
self.add_attestations_to_op_pool(
|
||||
self.add_free_attestations(
|
||||
&attestation_strategy,
|
||||
&new_state,
|
||||
block_root,
|
||||
@@ -256,10 +256,10 @@ where
|
||||
(block, state)
|
||||
}
|
||||
|
||||
/// Adds attestations to the `BeaconChain` operations pool to be included in future blocks.
|
||||
/// Adds attestations to the `BeaconChain` operations pool and fork choice.
|
||||
///
|
||||
/// The `attestation_strategy` dictates which validators should attest.
|
||||
fn add_attestations_to_op_pool(
|
||||
fn add_free_attestations(
|
||||
&self,
|
||||
attestation_strategy: &AttestationStrategy,
|
||||
state: &BeaconState<E>,
|
||||
|
||||
Reference in New Issue
Block a user