mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-28 14:57:17 +00:00
Tidy attestation_processing, add docstrings.
This commit is contained in:
parent
a86f7fa51b
commit
2ed5f69448
@ -1,13 +1,11 @@
|
||||
use super::{BeaconChain, ClientDB, SlotClock};
|
||||
pub use crate::attestation_aggregator::{Error as AggregatorError, ProcessOutcome};
|
||||
use crate::canonical_head::Error as HeadError;
|
||||
use types::FreeAttestation;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Error {
|
||||
PresentSlotUnknown,
|
||||
/// The free attestation was not processed succesfully.
|
||||
AggregatorError(AggregatorError),
|
||||
HeadError(HeadError),
|
||||
}
|
||||
|
||||
impl<T, U> BeaconChain<T, U>
|
||||
@ -15,6 +13,10 @@ where
|
||||
T: ClientDB,
|
||||
U: SlotClock,
|
||||
{
|
||||
/// Validate a `FreeAttestation` and either:
|
||||
///
|
||||
/// - Create a new `Attestation`.
|
||||
/// - Aggregate it to an existing `Attestation`.
|
||||
pub fn process_free_attestation(
|
||||
&self,
|
||||
free_attestation: FreeAttestation,
|
||||
@ -31,9 +33,3 @@ impl From<AggregatorError> for Error {
|
||||
Error::AggregatorError(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<HeadError> for Error {
|
||||
fn from(e: HeadError) -> Error {
|
||||
Error::HeadError(e)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user