Implement block imports for sync

This commit is contained in:
Paul Hauner
2019-03-23 18:48:09 +11:00
parent 4b5b5851a6
commit a57a7c2394
6 changed files with 239 additions and 22 deletions

View File

@@ -10,7 +10,7 @@ use beacon_chain::{
use eth2_libp2p::HelloMessage;
use types::{BeaconBlock, BeaconStateError, Epoch, Hash256, Slot};
pub use beacon_chain::BeaconChainError;
pub use beacon_chain::{BeaconChainError, BlockProcessingOutcome};
/// The network's API to the beacon chain.
pub trait BeaconChain: Send + Sync {
@@ -34,6 +34,9 @@ pub trait BeaconChain: Send + Sync {
fn hello_message(&self) -> HelloMessage;
fn process_block(&self, block: BeaconBlock)
-> Result<BlockProcessingOutcome, BeaconChainError>;
fn get_block_roots(
&self,
start_slot: Slot,
@@ -98,6 +101,13 @@ where
}
}
fn process_block(
&self,
block: BeaconBlock,
) -> Result<BlockProcessingOutcome, BeaconChainError> {
self.process_block(block)
}
fn get_block_roots(
&self,
start_slot: Slot,