feature: Add a checkpoint_sync config option

(The option doesn't do anything yet.)
This commit is contained in:
teor 2020-08-20 12:25:46 +10:00
parent f88d324911
commit 06f4a59664
5 changed files with 34 additions and 2 deletions

1
Cargo.lock generated
View File

@ -3085,6 +3085,7 @@ dependencies = [
"once_cell", "once_cell",
"rand 0.7.3", "rand 0.7.3",
"redjubjub", "redjubjub",
"serde",
"spandoc", "spandoc",
"tokio", "tokio",
"tower", "tower",

View File

@ -8,18 +8,19 @@ edition = "2018"
[dependencies] [dependencies]
chrono = "0.4.13" chrono = "0.4.13"
color-eyre = "0.5" color-eyre = "0.5"
once_cell = "1.4"
rand = "0.7" rand = "0.7"
redjubjub = "0.2" redjubjub = "0.2"
serde = { version = "1", features = ["serde_derive"] }
metrics = "0.12"
futures = "0.3.5" futures = "0.3.5"
futures-util = "0.3.5" futures-util = "0.3.5"
metrics = "0.12"
tokio = { version = "0.2.22", features = ["time", "sync", "stream", "tracing"] } tokio = { version = "0.2.22", features = ["time", "sync", "stream", "tracing"] }
tower = "0.3" tower = "0.3"
tower-util = "0.3" tower-util = "0.3"
tracing = "0.1.19" tracing = "0.1.19"
tracing-futures = "0.2.4" tracing-futures = "0.2.4"
once_cell = "1.4"
tower-fallback = { path = "../tower-fallback/" } tower-fallback = { path = "../tower-fallback/" }
tower-batch = { path = "../tower-batch/" } tower-batch = { path = "../tower-batch/" }

View File

@ -0,0 +1,22 @@
//! Configuration for zebra-consensus
use serde::{Deserialize, Serialize};
/// Consensus configuration.
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields, default)]
pub struct Config {
/// Should Zebra sync using checkpoints?
///
/// Setting this option to true enables post-Sapling checkpoints.
/// (Zebra always checkpoints on Sapling activation.)
pub checkpoint_sync: bool,
}
impl Default for Config {
fn default() -> Self {
Self {
checkpoint_sync: false,
}
}
}

View File

@ -18,9 +18,13 @@
pub mod block; pub mod block;
pub mod chain; pub mod chain;
pub mod checkpoint; pub mod checkpoint;
pub mod config;
pub mod mempool; pub mod mempool;
pub mod parameters; pub mod parameters;
#[allow(dead_code)] // Remove this once transaction verification is implemented #[allow(dead_code)] // Remove this once transaction verification is implemented
mod primitives; mod primitives;
mod script; mod script;
mod transaction; mod transaction;
pub use crate::config::Config;

View File

@ -8,6 +8,7 @@ use std::{net::SocketAddr, path::PathBuf};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use zebra_consensus::Config as ConsensusSection;
use zebra_network::Config as NetworkSection; use zebra_network::Config as NetworkSection;
use zebra_state::Config as StateSection; use zebra_state::Config as StateSection;
@ -19,6 +20,9 @@ use zebra_state::Config as StateSection;
#[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 {
/// Consensus configuration
pub consensus: ConsensusSection,
/// Metrics configuration /// Metrics configuration
pub metrics: MetricsSection, pub metrics: MetricsSection,