Build validator client AttestationProducer

This commit is contained in:
Age Manning
2019-03-30 17:56:43 +11:00
parent a952acb86f
commit 145cabc427
5 changed files with 83 additions and 52 deletions

View File

@@ -38,7 +38,7 @@ impl EpochDuty {
// if the validator is required to attest to a shard, create the data
let mut attestation_duty = None;
if self.attestation_duty.slot == slot {
attestation_duty = self.attestation_duty
attestation_duty = Some(self.attestation_duty)
}
if produce_block | attestation_duty.is_some() {
@@ -60,7 +60,7 @@ impl fmt::Display for EpochDuty {
write!(
f,
"produce block slot: {}, attestation slot: {}, attestation shard: {}",
display_block, self.attestation_slot, self.attestation_shard
display_block, self.attestation_duty.slot, self.attestation_duty.shard
)
}
}

View File

@@ -6,7 +6,7 @@ use protos::services_grpc::ValidatorServiceClient;
use ssz::ssz_encode;
use std::collections::HashMap;
use std::time::Duration;
use types::{Epoch, PublicKey, Slot};
use types::{AttestationDuty, Epoch, PublicKey, Slot};
impl BeaconNodeDuties for ValidatorServiceClient {
/// Requests all duties (block signing and committee attesting) from the Beacon Node (BN).
@@ -49,11 +49,11 @@ impl BeaconNodeDuties for ValidatorServiceClient {
};
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,
}
slot: Slot::from(active_duty.get_attestation_slot()),
shard: active_duty.get_attestation_shard(),
committee_index: active_duty.get_committee_index() as usize,
committee_len: 10,
};
let epoch_duty = EpochDuty {
block_production_slot,