ckb_chain_spec::consensus

Struct ConsensusBuilder

Source
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

Source

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.

Source

pub fn build(self) -> Consensus

Build a new Consensus by taking ownership of the Builder, and returns a Consensus.

Source

pub fn id(self, id: String) -> Self

Names the network.

Source

pub fn genesis_block(self, genesis_block: BlockView) -> Self

Sets genesis_block for the new Consensus.

Source

pub fn initial_primary_epoch_reward( self, initial_primary_epoch_reward: Capacity, ) -> Self

Sets initial_primary_epoch_reward for the new Consensus.

Source

pub fn orphan_rate_target(self, orphan_rate_target: (u32, u32)) -> Self

Sets orphan_rate_target for the new Consensus.

Source

pub fn secondary_epoch_reward(self, secondary_epoch_reward: Capacity) -> Self

Sets secondary_epoch_reward for the new Consensus.

Source

pub fn max_block_cycles(self, max_block_cycles: Cycle) -> Self

Sets max_block_cycles for the new Consensus.

Source

pub fn max_block_bytes(self, max_block_bytes: u64) -> Self

Sets max_block_bytes for the new Consensus.

Source

pub fn cellbase_maturity( self, cellbase_maturity: EpochNumberWithFraction, ) -> Self

Sets cellbase_maturity for the new Consensus.

Source

pub fn median_time_block_count(self, median_time_block_count: usize) -> Self

Sets median_time_block_count for the new Consensus.

Source

pub fn tx_proposal_window(self, proposal_window: ProposalWindow) -> Self

Sets tx_proposal_window for the new Consensus.

Source

pub fn pow(self, pow: Pow) -> Self

Sets pow for the new Consensus.

Source

pub fn satoshi_pubkey_hash(self, pubkey_hash: H160) -> Self

Sets satoshi_pubkey_hash for the new Consensus.

Source

pub fn satoshi_cell_occupied_ratio(self, ratio: Ratio) -> Self

Sets satoshi_cell_occupied_ratio for the new Consensus.

Source

pub fn primary_epoch_reward_halving_interval( self, halving_interval: u64, ) -> Self

Sets primary_epoch_reward_halving_interval for the new Consensus.

Source

pub fn epoch_duration_target(self, target: u64) -> Self

Sets expected epoch_duration_target for the new Consensus.

Source

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

Source

pub fn max_block_proposals_limit(self, max_block_proposals_limit: u64) -> Self

Sets max_block_proposals_limit for the new Consensus.

Source

pub fn hardfork_switch(self, hardfork_switch: HardForks) -> Self

Sets a hard fork switch for the new Consensus.

Source

pub fn softfork_deployments( self, deployments: HashMap<DeploymentPos, Deployment>, ) -> Self

Sets a soft fork deployments for the new Consensus.

Source

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§

Source§

impl Default for ConsensusBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Cast to trait Any
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V