Use AttestationDuty in epoch duties
This commit is contained in:
parent
c107ebf9aa
commit
bb8938c564
@ -6,4 +6,5 @@ pub struct AttestationDuty {
|
||||
pub slot: Slot,
|
||||
pub shard: Shard,
|
||||
pub committee_index: usize,
|
||||
pub comittee_size: usize,
|
||||
}
|
||||
|
@ -23,9 +23,7 @@ pub struct WorkInfo {
|
||||
#[derive(Debug, PartialEq, Clone, Copy, Default)]
|
||||
pub struct EpochDuty {
|
||||
pub block_production_slot: Option<Slot>,
|
||||
pub attestation_slot: Slot,
|
||||
pub attestation_shard: u64,
|
||||
pub committee_index: u64,
|
||||
pub attestation_duty: AttestationDuty,
|
||||
}
|
||||
|
||||
impl EpochDuty {
|
||||
@ -39,12 +37,8 @@ impl EpochDuty {
|
||||
|
||||
// if the validator is required to attest to a shard, create the data
|
||||
let mut attestation_duty = None;
|
||||
if self.attestation_slot == slot {
|
||||
attestation_duty = Some(AttestationDuty {
|
||||
slot,
|
||||
shard: self.attestation_shard,
|
||||
committee_index: self.committee_index as usize,
|
||||
});
|
||||
if self.attestation_duty.slot == slot {
|
||||
attestation_duty = self.attestation_duty
|
||||
}
|
||||
|
||||
if produce_block | attestation_duty.is_some() {
|
||||
|
@ -47,11 +47,17 @@ impl BeaconNodeDuties for ValidatorServiceClient {
|
||||
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 {
|
||||
block_production_slot,
|
||||
attestation_slot: Slot::from(active_duty.get_attestation_slot()),
|
||||
attestation_shard: active_duty.get_attestation_shard(),
|
||||
committee_index: active_duty.get_committee_index(),
|
||||
attestation_duty,
|
||||
};
|
||||
epoch_duties.insert(pub_keys[index].clone(), Some(epoch_duty));
|
||||
}
|
||||
|
@ -30,7 +30,6 @@ pub enum UpdateOutcome {
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Error {
|
||||
DutiesMapPoisoned,
|
||||
EpochMapPoisoned,
|
||||
BeaconNodeDutiesError(BeaconNodeDutiesError),
|
||||
UnknownEpoch,
|
||||
UnknownValidator,
|
||||
|
Loading…
Reference in New Issue
Block a user