feature: Add the state config to the config file
This commit is contained in:
parent
e75697300b
commit
3d721a96a5
|
|
@ -15,9 +15,10 @@ impl Runnable for GenerateCmd {
|
||||||
/// Start the application.
|
/// Start the application.
|
||||||
fn run(&self) {
|
fn run(&self) {
|
||||||
let default_config = ZebradConfig {
|
let default_config = ZebradConfig {
|
||||||
tracing: crate::config::TracingSection::populated(),
|
|
||||||
network: Default::default(),
|
|
||||||
metrics: Default::default(),
|
metrics: Default::default(),
|
||||||
|
network: Default::default(),
|
||||||
|
state: Default::default(),
|
||||||
|
tracing: crate::config::TracingSection::populated(),
|
||||||
};
|
};
|
||||||
let mut output = r"# Default configuration for zebrad.
|
let mut output = r"# Default configuration for zebrad.
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ pub struct StartCmd {
|
||||||
|
|
||||||
impl StartCmd {
|
impl StartCmd {
|
||||||
async fn start(&self) -> Result<(), Report> {
|
async fn start(&self) -> Result<(), Report> {
|
||||||
info!(?self, "begin tower-based peer handling test stub");
|
info!(?self, "starting to connect to the network");
|
||||||
|
|
||||||
// The service that our node uses to respond to requests by peers
|
// The service that our node uses to respond to requests by peers
|
||||||
let node = Buffer::new(
|
let node = Buffer::new(
|
||||||
|
|
@ -57,9 +57,9 @@ impl StartCmd {
|
||||||
}),
|
}),
|
||||||
1,
|
1,
|
||||||
);
|
);
|
||||||
let config = app_config().network.clone();
|
let config = app_config();
|
||||||
let state = zebra_state::on_disk::init(zebra_state::Config::default());
|
let state = zebra_state::on_disk::init(config.state.clone());
|
||||||
let (peer_set, _address_book) = zebra_network::init(config, node).await;
|
let (peer_set, _address_book) = zebra_network::init(config.network.clone(), node).await;
|
||||||
let verifier = zebra_consensus::chain::init(Mainnet, state.clone());
|
let verifier = zebra_consensus::chain::init(Mainnet, state.clone());
|
||||||
|
|
||||||
let mut syncer = sync::Syncer::new(peer_set, state, verifier);
|
let mut syncer = sync::Syncer::new(peer_set, state, verifier);
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ use std::net::SocketAddr;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use zebra_network::Config as NetworkSection;
|
use zebra_network::Config as NetworkSection;
|
||||||
|
use zebra_state::Config as StateSection;
|
||||||
|
|
||||||
/// Configuration for `zebrad`.
|
/// Configuration for `zebrad`.
|
||||||
///
|
///
|
||||||
|
|
@ -18,12 +19,17 @@ use zebra_network::Config as NetworkSection;
|
||||||
#[derive(Clone, Default, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Default, Debug, Deserialize, Serialize)]
|
||||||
#[serde(deny_unknown_fields, default)]
|
#[serde(deny_unknown_fields, default)]
|
||||||
pub struct ZebradConfig {
|
pub struct ZebradConfig {
|
||||||
/// Tracing configuration
|
|
||||||
pub tracing: TracingSection,
|
|
||||||
/// Networking configuration
|
|
||||||
pub network: NetworkSection,
|
|
||||||
/// Metrics configuration
|
/// Metrics configuration
|
||||||
pub metrics: MetricsSection,
|
pub metrics: MetricsSection,
|
||||||
|
|
||||||
|
/// Networking configuration
|
||||||
|
pub network: NetworkSection,
|
||||||
|
|
||||||
|
/// State configuration
|
||||||
|
pub state: StateSection,
|
||||||
|
|
||||||
|
/// Tracing configuration
|
||||||
|
pub tracing: TracingSection,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tracing configuration section.
|
/// Tracing configuration section.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue