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