pub struct ConsensusBuilder { /* private fields */ }
Expand description
The Consensus factory, which can be used in order to configure the properties of a new Consensus.
Implementations§
Source§impl ConsensusBuilder
impl ConsensusBuilder
Sourcepub fn new(genesis_block: BlockView, genesis_epoch_ext: EpochExt) -> Self
pub fn new(genesis_block: BlockView, genesis_epoch_ext: EpochExt) -> Self
Generates the base configuration for build a Consensus, from which configuration methods can be chained.
Sourcepub fn build(self) -> Consensus
pub fn build(self) -> Consensus
Build a new Consensus by taking ownership of the Builder
, and returns a Consensus
.
Sourcepub fn genesis_block(self, genesis_block: BlockView) -> Self
pub fn genesis_block(self, genesis_block: BlockView) -> Self
Sets genesis_block for the new Consensus.
Sourcepub fn initial_primary_epoch_reward(
self,
initial_primary_epoch_reward: Capacity,
) -> Self
pub fn initial_primary_epoch_reward( self, initial_primary_epoch_reward: Capacity, ) -> Self
Sets initial_primary_epoch_reward for the new Consensus.
Sourcepub fn orphan_rate_target(self, orphan_rate_target: (u32, u32)) -> Self
pub fn orphan_rate_target(self, orphan_rate_target: (u32, u32)) -> Self
Sets orphan_rate_target for the new Consensus.
Sourcepub fn secondary_epoch_reward(self, secondary_epoch_reward: Capacity) -> Self
pub fn secondary_epoch_reward(self, secondary_epoch_reward: Capacity) -> Self
Sets secondary_epoch_reward for the new Consensus.
Sourcepub fn max_block_cycles(self, max_block_cycles: Cycle) -> Self
pub fn max_block_cycles(self, max_block_cycles: Cycle) -> Self
Sets max_block_cycles for the new Consensus.
Sourcepub fn max_block_bytes(self, max_block_bytes: u64) -> Self
pub fn max_block_bytes(self, max_block_bytes: u64) -> Self
Sets max_block_bytes for the new Consensus.
Sourcepub fn cellbase_maturity(
self,
cellbase_maturity: EpochNumberWithFraction,
) -> Self
pub fn cellbase_maturity( self, cellbase_maturity: EpochNumberWithFraction, ) -> Self
Sets cellbase_maturity for the new Consensus.
Sourcepub fn median_time_block_count(self, median_time_block_count: usize) -> Self
pub fn median_time_block_count(self, median_time_block_count: usize) -> Self
Sets median_time_block_count for the new Consensus.
Sourcepub fn tx_proposal_window(self, proposal_window: ProposalWindow) -> Self
pub fn tx_proposal_window(self, proposal_window: ProposalWindow) -> Self
Sets tx_proposal_window for the new Consensus.
Sourcepub fn satoshi_pubkey_hash(self, pubkey_hash: H160) -> Self
pub fn satoshi_pubkey_hash(self, pubkey_hash: H160) -> Self
Sets satoshi_pubkey_hash for the new Consensus.
Sourcepub fn satoshi_cell_occupied_ratio(self, ratio: Ratio) -> Self
pub fn satoshi_cell_occupied_ratio(self, ratio: Ratio) -> Self
Sets satoshi_cell_occupied_ratio for the new Consensus.
Sourcepub fn primary_epoch_reward_halving_interval(
self,
halving_interval: u64,
) -> Self
pub fn primary_epoch_reward_halving_interval( self, halving_interval: u64, ) -> Self
Sets primary_epoch_reward_halving_interval for the new Consensus.
Sourcepub fn epoch_duration_target(self, target: u64) -> Self
pub fn epoch_duration_target(self, target: u64) -> Self
Sets expected epoch_duration_target for the new Consensus.
Sourcepub fn permanent_difficulty_in_dummy(self, permanent: bool) -> Self
pub fn permanent_difficulty_in_dummy(self, permanent: bool) -> Self
Sets permanent_difficulty_in_dummy for the new Consensus.
dynamic-difficulty-adjustment-mechanism may be a disturbance in dev chain, set permanent_difficulty_in_dummy to true will disable dynamic difficulty adjustment mechanism. keep difficulty unchanged. Work only under dummy Pow
Sourcepub fn max_block_proposals_limit(self, max_block_proposals_limit: u64) -> Self
pub fn max_block_proposals_limit(self, max_block_proposals_limit: u64) -> Self
Sets max_block_proposals_limit for the new Consensus.
Sourcepub fn hardfork_switch(self, hardfork_switch: HardForks) -> Self
pub fn hardfork_switch(self, hardfork_switch: HardForks) -> Self
Sets a hard fork switch for the new Consensus.
Sourcepub fn softfork_deployments(
self,
deployments: HashMap<DeploymentPos, Deployment>,
) -> Self
pub fn softfork_deployments( self, deployments: HashMap<DeploymentPos, Deployment>, ) -> Self
Sets a soft fork deployments for the new Consensus.
Sourcepub fn starting_block_limiting_dao_withdrawing_lock(
self,
starting_block_limiting_dao_withdrawing_lock: u64,
) -> Self
pub fn starting_block_limiting_dao_withdrawing_lock( self, starting_block_limiting_dao_withdrawing_lock: u64, ) -> Self
The starting block number where Nervos DAO withdrawing cell’s lock is size limited.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ConsensusBuilder
impl RefUnwindSafe for ConsensusBuilder
impl Send for ConsensusBuilder
impl Sync for ConsensusBuilder
impl Unpin for ConsensusBuilder
impl UnwindSafe for ConsensusBuilder
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<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