Introduce Fork struct to block_producer

It's a pretty crappy solution, IMO. It shouldn't really belong in
"duties" but this gets the job done for now.
This commit is contained in:
Paul Hauner
2019-03-07 13:54:56 +11:00
parent 20ac1bf1f0
commit db3b6cba6d
6 changed files with 54 additions and 18 deletions

View File

@@ -50,6 +50,9 @@ impl<T: SlotClock, U: BeaconNode, V: DutiesReader, W: Signer> BlockProducerServi
Ok(BlockProducerPollOutcome::ValidatorIsUnknown(slot)) => {
error!(self.log, "The Beacon Node does not recognise the validator"; "slot" => slot)
}
Ok(BlockProducerPollOutcome::UnableToGetFork(slot)) => {
error!(self.log, "Unable to get a `Fork` struct to generate signature domains"; "slot" => slot)
}
};
std::thread::sleep(Duration::from_millis(self.poll_interval_millis));

View File

@@ -1,7 +1,7 @@
use block_proposer::{DutiesReader, DutiesReaderError};
use std::collections::HashMap;
use std::sync::RwLock;
use types::{Epoch, Slot};
use types::{Epoch, Fork, Slot};
/// The information required for a validator to propose and attest during some epoch.
///
@@ -75,6 +75,17 @@ impl DutiesReader for EpochDutiesMap {
.ok_or_else(|| DutiesReaderError::UnknownEpoch)?;
Ok(duties.is_block_production_slot(slot))
}
fn fork(&self) -> Result<Fork, DutiesReaderError> {
// TODO: this is garbage data.
//
// It will almost certainly cause signatures to fail verification.
Ok(Fork {
previous_version: 0,
current_version: 0,
epoch: Epoch::new(0),
})
}
}
// TODO: add tests.