diff --git a/beacon_node/beacon_chain/src/attestation_production.rs b/beacon_node/beacon_chain/src/attestation_production.rs index febd2ff9a..40284877e 100644 --- a/beacon_node/beacon_chain/src/attestation_production.rs +++ b/beacon_node/beacon_chain/src/attestation_production.rs @@ -3,9 +3,10 @@ use types::{AttestationData, Hash256}; #[derive(Debug, PartialEq)] pub enum Error { - SlotTooOld, - PresentSlotUnknown, - StateError, + /// The `justified_block_root` is unknown. This is an internal error. + UnknownJustifiedRoot, + /// The `epoch_boundary_root` is unknown. This is an internal error. + UnknownBoundaryRoot, } impl BeaconChain @@ -13,13 +14,14 @@ where T: ClientDB, U: SlotClock, { + /// Produce an `AttestationData` that is valid for the present `slot` and given `shard`. pub fn produce_attestation_data(&self, shard: u64) -> Result { let justified_slot = self.justified_slot(); let justified_block_root = self .state .read() .get_block_root(justified_slot, &self.spec) - .ok_or_else(|| Error::SlotTooOld)? + .ok_or_else(|| Error::UnknownJustifiedRoot)? .clone(); let epoch_boundary_root = self @@ -29,7 +31,7 @@ where self.state.read().current_epoch_start_slot(&self.spec), &self.spec, ) - .ok_or_else(|| Error::SlotTooOld)? + .ok_or_else(|| Error::UnknownBoundaryRoot)? .clone(); Ok(AttestationData {