Add flag for web3 server

This commit is contained in:
Paul Hauner
2019-09-03 16:40:53 +10:00
parent 29584ca087
commit d80d9dba4c
7 changed files with 85 additions and 57 deletions

View File

@@ -23,6 +23,7 @@ pub struct Config {
/// files. It can only be configured via the CLI.
#[serde(skip)]
pub beacon_chain_start_method: BeaconChainStartMethod,
pub eth1_backend_method: Eth1BackendMethod,
pub network: network::NetworkConfig,
pub rpc: rpc::RPCConfig,
pub rest_api: rest_api::ApiConfig,
@@ -69,6 +70,22 @@ impl Default for BeaconChainStartMethod {
}
}
/// Defines which Eth1 backend the client should use.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type")]
pub enum Eth1BackendMethod {
/// Use the mocked eth1 backend used in interop testing
Interop,
/// Use a web3 connection to a running Eth1 node.
Web3 { server: String },
}
impl Default for Eth1BackendMethod {
fn default() -> Self {
Eth1BackendMethod::Interop
}
}
impl Default for Config {
fn default() -> Self {
Self {
@@ -81,6 +98,7 @@ impl Default for Config {
rest_api: <_>::default(),
spec_constants: TESTNET_SPEC_CONSTANTS.into(),
beacon_chain_start_method: <_>::default(),
eth1_backend_method: <_>::default(),
}
}
}