Use AttestationDuty in epoch duties

This commit is contained in:
Age Manning 2019-03-30 17:14:38 +11:00
parent c107ebf9aa
commit bb8938c564
No known key found for this signature in database
GPG Key ID: 05EED64B79E06A93
4 changed files with 13 additions and 13 deletions

View File

@ -6,4 +6,5 @@ pub struct AttestationDuty {
pub slot: Slot, pub slot: Slot,
pub shard: Shard, pub shard: Shard,
pub committee_index: usize, pub committee_index: usize,
pub comittee_size: usize,
} }

View File

@ -23,9 +23,7 @@ pub struct WorkInfo {
#[derive(Debug, PartialEq, Clone, Copy, Default)] #[derive(Debug, PartialEq, Clone, Copy, Default)]
pub struct EpochDuty { pub struct EpochDuty {
pub block_production_slot: Option<Slot>, pub block_production_slot: Option<Slot>,
pub attestation_slot: Slot, pub attestation_duty: AttestationDuty,
pub attestation_shard: u64,
pub committee_index: u64,
} }
impl EpochDuty { impl EpochDuty {
@ -39,12 +37,8 @@ impl EpochDuty {
// if the validator is required to attest to a shard, create the data // if the validator is required to attest to a shard, create the data
let mut attestation_duty = None; let mut attestation_duty = None;
if self.attestation_slot == slot { if self.attestation_duty.slot == slot {
attestation_duty = Some(AttestationDuty { attestation_duty = self.attestation_duty
slot,
shard: self.attestation_shard,
committee_index: self.committee_index as usize,
});
} }
if produce_block | attestation_duty.is_some() { if produce_block | attestation_duty.is_some() {

View File

@ -47,11 +47,17 @@ impl BeaconNodeDuties for ValidatorServiceClient {
None None
} }
}; };
let attestation_duty = AttestationDuty {
slot: Slot::from(active_duty.get_attestation_slot()),
shard: active_duty.get_attestation_shard(),
committee_index: active_duty.get_committee_index(),
comittee_size: 10,
}
let epoch_duty = EpochDuty { let epoch_duty = EpochDuty {
block_production_slot, block_production_slot,
attestation_slot: Slot::from(active_duty.get_attestation_slot()), attestation_duty,
attestation_shard: active_duty.get_attestation_shard(),
committee_index: active_duty.get_committee_index(),
}; };
epoch_duties.insert(pub_keys[index].clone(), Some(epoch_duty)); epoch_duties.insert(pub_keys[index].clone(), Some(epoch_duty));
} }

View File

@ -30,7 +30,6 @@ pub enum UpdateOutcome {
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq)]
pub enum Error { pub enum Error {
DutiesMapPoisoned, DutiesMapPoisoned,
EpochMapPoisoned,
BeaconNodeDutiesError(BeaconNodeDutiesError), BeaconNodeDutiesError(BeaconNodeDutiesError),
UnknownEpoch, UnknownEpoch,
UnknownValidator, UnknownValidator,