Create BeaconChainTypes, thread through runtime

This commit is contained in:
Paul Hauner
2019-05-25 20:51:15 +10:00
parent 45e3a1759c
commit ee8d13573f
24 changed files with 254 additions and 452 deletions

View File

@@ -1,19 +1,18 @@
use crate::beacon_chain::BeaconChain;
use crate::beacon_chain::{BeaconChain, BeaconChainTypes};
use futures::Future;
use grpcio::{RpcContext, UnarySink};
use protos::services::{Empty, Fork, NodeInfoResponse};
use protos::services_grpc::BeaconNodeService;
use slog::{trace, warn};
use std::sync::Arc;
use types::EthSpec;
#[derive(Clone)]
pub struct BeaconNodeServiceInstance<E: EthSpec> {
pub chain: Arc<BeaconChain<E>>,
pub struct BeaconNodeServiceInstance<T: BeaconChainTypes> {
pub chain: Arc<BeaconChain<T>>,
pub log: slog::Logger,
}
impl<E: EthSpec> BeaconNodeService for BeaconNodeServiceInstance<E> {
impl<T: BeaconChainTypes> BeaconNodeService for BeaconNodeServiceInstance<T> {
/// Provides basic node information.
fn info(&mut self, ctx: RpcContext, _req: Empty, sink: UnarySink<NodeInfoResponse>) {
trace!(self.log, "Node info requested via RPC");