pub struct Config {Show 15 fields
pub params: Params,
pub perf: PerfParams,
pub process_genesis: bool,
pub is_archival: bool,
pub enable_sanity_checks: bool,
pub utxoindex: bool,
pub unsafe_rpc: bool,
pub enable_unsynced_mining: bool,
pub enable_mainnet_mining: bool,
pub user_agent_comments: Vec<String>,
pub p2p_listen_address: ContextualNetAddress,
pub externalip: Option<NetAddress>,
pub block_template_cache_lifetime: Option<u64>,
pub disable_upnp: bool,
pub ram_scale: f64,
}Expand description
Various consensus configurations all bundled up under a single struct. Use Config::new for directly building from
a Params instance. For anything more complex it is recommended to use ConfigBuilder. NOTE: this struct can be
implicitly de-refed into Params
Fields§
§params: ParamsConsensus params
perf: PerfParamsPerformance params
process_genesis: bool§is_archival: boolIndicates whether this node is an archival node
enable_sanity_checks: boolEnable various sanity checks which might be compute-intensive (mostly performed during pruning)
utxoindex: boolEnable the UTXO index
unsafe_rpc: boolEnable RPC commands which affect the state of the node
enable_unsynced_mining: boolAllow the node to accept blocks from RPC while not synced (required when initiating a new network from genesis)
enable_mainnet_mining: boolAllow mainnet mining. Until a stable Beta version we keep this option off by default
user_agent_comments: Vec<String>§p2p_listen_address: ContextualNetAddressIf undefined, sets it to 0.0.0.0
externalip: Option<NetAddress>§block_template_cache_lifetime: Option<u64>§disable_upnp: bool§ram_scale: f64A scale factor to apply to memory allocation bounds
Implementations§
Source§impl Config
impl Config
pub fn new(params: Params) -> Config
pub fn with_perf(params: Params, perf: PerfParams) -> Config
pub fn to_builder(&self) -> ConfigBuilder
Methods from Deref<Target = Params>§
Sourcepub fn legacy_past_median_time_window_size(&self) -> usize
pub fn legacy_past_median_time_window_size(&self) -> usize
Returns the size of the full blocks window that is inspected to calculate the past median time (legacy)
Sourcepub fn sampled_past_median_time_window_size(&self) -> usize
pub fn sampled_past_median_time_window_size(&self) -> usize
Returns the size of the sampled blocks window that is inspected to calculate the past median time
Sourcepub fn past_median_time_window_size(
&self,
selected_parent_daa_score: u64,
) -> usize
pub fn past_median_time_window_size( &self, selected_parent_daa_score: u64, ) -> usize
Returns the size of the blocks window that is inspected to calculate the past median time, depending on a selected parent DAA score
Sourcepub fn timestamp_deviation_tolerance(
&self,
selected_parent_daa_score: u64,
) -> u64
pub fn timestamp_deviation_tolerance( &self, selected_parent_daa_score: u64, ) -> u64
Returns the timestamp deviation tolerance, depending on a selected parent DAA score
Sourcepub fn past_median_time_sample_rate(
&self,
selected_parent_daa_score: u64,
) -> u64
pub fn past_median_time_sample_rate( &self, selected_parent_daa_score: u64, ) -> u64
Returns the past median time sample rate, depending on a selected parent DAA score
Sourcepub fn difficulty_window_size(&self, selected_parent_daa_score: u64) -> usize
pub fn difficulty_window_size(&self, selected_parent_daa_score: u64) -> usize
Returns the size of the blocks window that is inspected to calculate the difficulty, depending on a selected parent DAA score
Sourcepub fn difficulty_sample_rate(&self, selected_parent_daa_score: u64) -> u64
pub fn difficulty_sample_rate(&self, selected_parent_daa_score: u64) -> u64
Returns the difficulty sample rate, depending on a selected parent DAA score
Sourcepub fn target_time_per_block(&self, _selected_parent_daa_score: u64) -> u64
pub fn target_time_per_block(&self, _selected_parent_daa_score: u64) -> u64
Returns the target time per block, depending on a selected parent DAA score
pub fn daa_window_duration_in_blocks( &self, selected_parent_daa_score: u64, ) -> u64
Sourcepub fn anticone_finalization_depth(&self) -> u64
pub fn anticone_finalization_depth(&self) -> u64
Returns the depth at which the anticone of a chain block is final (i.e., is a permanently closed set). Based on the analysis at https://github.com/kaspanet/docs/blob/main/Reference/prunality/Prunality.pdf and on the decomposition of merge depth (rule R-I therein) from finality depth (φ)
Sourcepub fn is_nearly_synced(&self, sink_timestamp: u64, sink_daa_score: u64) -> bool
pub fn is_nearly_synced(&self, sink_timestamp: u64, sink_daa_score: u64) -> bool
Returns whether the sink timestamp is recent enough and the node is considered synced or nearly synced.
pub fn network_name(&self) -> String
pub fn prefix(&self) -> Prefix
pub fn default_p2p_port(&self) -> u16
pub fn default_rpc_port(&self) -> u16
pub fn finality_duration(&self) -> u64
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<S> CastArc for Swhere
S: CastFromSync + ?Sized,
impl<S> CastArc for Swhere
S: CastFromSync + ?Sized,
Source§impl<T> CastFrom for Twhere
T: Any + 'static,
impl<T> CastFrom for Twhere
T: Any + 'static,
Source§fn ref_any(&self) -> &(dyn Any + 'static)
fn ref_any(&self) -> &(dyn Any + 'static)
Any, which is backed by the type implementing this trait.Source§fn mut_any(&mut self) -> &mut (dyn Any + 'static)
fn mut_any(&mut self) -> &mut (dyn Any + 'static)
Any, which is backed by the type implementing this trait.Source§impl<T> CastFromSync for T
impl<T> CastFromSync for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more