pub struct Params {Show 39 fields
pub dns_seeders: &'static [&'static str],
pub net: NetworkId,
pub genesis: GenesisBlock,
pub ghostdag_k: u16,
pub legacy_timestamp_deviation_tolerance: u64,
pub new_timestamp_deviation_tolerance: u64,
pub past_median_time_sample_rate: u64,
pub past_median_time_sampled_window_size: u64,
pub target_time_per_block: u64,
pub sampling_activation_daa_score: u64,
pub max_difficulty_target: Uint256,
pub max_difficulty_target_f64: f64,
pub difficulty_sample_rate: u64,
pub sampled_difficulty_window_size: usize,
pub legacy_difficulty_window_size: usize,
pub min_difficulty_window_len: usize,
pub max_block_parents: u8,
pub mergeset_size_limit: u64,
pub merge_depth: u64,
pub finality_depth: u64,
pub pruning_depth: u64,
pub coinbase_payload_script_public_key_max_len: u8,
pub max_coinbase_payload_len: usize,
pub max_tx_inputs: usize,
pub max_tx_outputs: usize,
pub max_signature_script_len: usize,
pub max_script_public_key_len: usize,
pub mass_per_tx_byte: u64,
pub mass_per_script_pub_key_byte: u64,
pub mass_per_sig_op: u64,
pub max_block_mass: u64,
pub storage_mass_parameter: u64,
pub storage_mass_activation_daa_score: u64,
pub deflationary_phase_daa_score: u64,
pub pre_deflationary_phase_base_subsidy: u64,
pub coinbase_maturity: u64,
pub skip_proof_of_work: bool,
pub max_block_level: u8,
pub pruning_proof_m: u64,
}Expand description
Consensus parameters. Contains settings and configurations which are consensus-sensitive. Changing one of these on a network node would exclude and prevent it from reaching consensus with the other unmodified nodes.
Fields§
§dns_seeders: &'static [&'static str]§net: NetworkId§genesis: GenesisBlock§ghostdag_k: u16§legacy_timestamp_deviation_tolerance: u64Legacy timestamp deviation tolerance (in seconds)
new_timestamp_deviation_tolerance: u64New timestamp deviation tolerance (in seconds, activated with sampling)
past_median_time_sample_rate: u64Block sample rate for filling the past median time window (selects one every N blocks)
past_median_time_sampled_window_size: u64Size of sampled blocks window that is inspected to calculate the past median time of each block
target_time_per_block: u64Target time per block (in milliseconds)
sampling_activation_daa_score: u64DAA score from which the window sampling starts for difficulty and past median time calculation
max_difficulty_target: Uint256Defines the highest allowed proof of work difficulty value for a block as a Uint256
max_difficulty_target_f64: f64Highest allowed proof of work difficulty as a floating number
difficulty_sample_rate: u64Block sample rate for filling the difficulty window (selects one every N blocks)
sampled_difficulty_window_size: usizeSize of sampled blocks window that is inspected to calculate the required difficulty of each block
legacy_difficulty_window_size: usizeSize of full blocks window that is inspected to calculate the required difficulty of each block
min_difficulty_window_len: usizeThe minimum length a difficulty window (full or sampled) must have to trigger a DAA calculation
max_block_parents: u8§mergeset_size_limit: u64§merge_depth: u64§finality_depth: u64§pruning_depth: u64§coinbase_payload_script_public_key_max_len: u8§max_coinbase_payload_len: usize§max_tx_inputs: usize§max_tx_outputs: usize§max_signature_script_len: usize§max_script_public_key_len: usize§mass_per_tx_byte: u64§mass_per_script_pub_key_byte: u64§mass_per_sig_op: u64§max_block_mass: u64§storage_mass_parameter: u64The parameter for scaling inverse KAS value to mass units (unpublished KIP-0009)
storage_mass_activation_daa_score: u64DAA score from which storage mass calculation and transaction mass field are activated as a consensus rule
deflationary_phase_daa_score: u64DAA score after which the pre-deflationary period switches to the deflationary period
pre_deflationary_phase_base_subsidy: u64§coinbase_maturity: u64§skip_proof_of_work: bool§max_block_level: u8§pruning_proof_m: u64Implementations§
Source§impl Params
impl 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§
Source§impl From<NetworkType> for Params
impl From<NetworkType> for Params
Source§fn from(value: NetworkType) -> Params
fn from(value: NetworkType) -> Params
Auto Trait Implementations§
impl Freeze for Params
impl RefUnwindSafe for Params
impl Send for Params
impl Sync for Params
impl Unpin for Params
impl UnwindSafe for Params
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