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 slot: Slot,
|
||||||
pub shard: Shard,
|
pub shard: Shard,
|
||||||
pub committee_index: usize,
|
pub committee_index: usize,
|
||||||
|
pub comittee_size: usize,
|
||||||
}
|
}
|
||||||
|
@ -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() {
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user