From 2ed5f694484d0b52ef471bece888b11458fe4a18 Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Fri, 1 Feb 2019 15:19:50 +1100 Subject: [PATCH] Tidy attestation_processing, add docstrings. --- .../beacon_chain/src/attestation_processing.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/beacon_node/beacon_chain/src/attestation_processing.rs b/beacon_node/beacon_chain/src/attestation_processing.rs index bc7e2cda1f..4470c3d228 100644 --- a/beacon_node/beacon_chain/src/attestation_processing.rs +++ b/beacon_node/beacon_chain/src/attestation_processing.rs @@ -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 BeaconChain @@ -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 for Error { Error::AggregatorError(e) } } - -impl From for Error { - fn from(e: HeadError) -> Error { - Error::HeadError(e) - } -}