Update beacon_chain as per test bugs

This commit is contained in:
Paul Hauner
2019-01-25 11:30:06 +11:00
parent 643fc20063
commit f4f5b3a13c
9 changed files with 188 additions and 86 deletions

View File

@@ -2,15 +2,16 @@ use beacon_chain::{block_production::Error as BlockProductionError, BeaconChain}
use block_producer::{DutiesReader, DutiesReaderError};
use db::ClientDB;
use slot_clock::SlotClock;
use std::sync::Arc;
use types::PublicKey;
pub struct DirectDuties<'a, T: ClientDB, U: SlotClock> {
beacon_chain: &'a BeaconChain<T, U>,
pub struct DirectDuties<T: ClientDB, U: SlotClock> {
beacon_chain: Arc<BeaconChain<T, U>>,
pubkey: PublicKey,
}
impl<'a, T: ClientDB, U: SlotClock> DirectDuties<'a, T, U> {
pub fn new(pubkey: PublicKey, beacon_chain: &'a BeaconChain<T, U>) -> Self {
impl<T: ClientDB, U: SlotClock> DirectDuties<T, U> {
pub fn new(pubkey: PublicKey, beacon_chain: Arc<BeaconChain<T, U>>) -> Self {
Self {
beacon_chain,
pubkey,
@@ -18,11 +19,11 @@ impl<'a, T: ClientDB, U: SlotClock> DirectDuties<'a, T, U> {
}
}
impl<'a, T: ClientDB, U: SlotClock> DutiesReader for DirectDuties<'a, T, U>
impl<T: ClientDB, U: SlotClock> DutiesReader for DirectDuties<T, U>
where
BlockProductionError: From<<U>::Error>,
{
fn is_block_production_slot(&self, _epoch: u64, slot: u64) -> Result<bool, DutiesReaderError> {
fn is_block_production_slot(&self, slot: u64) -> Result<bool, DutiesReaderError> {
let validator_index = self
.beacon_chain
.validator_index(&self.pubkey)