bdk_chain::bitcoin::consensus

Struct Params

#[non_exhaustive]
pub struct Params {
Show 13 fields pub network: Network, pub bip16_time: u32, pub bip34_height: u32, pub bip65_height: u32, pub bip66_height: u32, pub rule_change_activation_threshold: u32, pub miner_confirmation_window: u32, pub pow_limit: Target, pub max_attainable_target: Target, pub pow_target_spacing: u64, pub pow_target_timespan: u64, pub allow_min_difficulty_blocks: bool, pub no_pow_retargeting: bool,
}
Expand description

Parameters that influence chain consensus.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§network: Network

Network for which parameters are valid.

§bip16_time: u32

Time when BIP16 becomes active.

§bip34_height: u32

Block height at which BIP34 becomes active.

§bip65_height: u32

Block height at which BIP65 becomes active.

§bip66_height: u32

Block height at which BIP66 becomes active.

§rule_change_activation_threshold: u32

Minimum blocks including miner confirmation of the total of 2016 blocks in a retargeting period, (nPowTargetTimespan / nPowTargetSpacing) which is also used for BIP9 deployments. Examples: 1916 for 95%, 1512 for testchains.

§miner_confirmation_window: u32

Number of blocks with the same set of rules.

§pow_limit: Target
👎Deprecated since 0.32.0: field renamed to max_attainable_target

Proof of work limit value. It contains the lowest possible difficulty.

§max_attainable_target: Target

The maximum attainable target value for these params.

Not all target values are attainable because consensus code uses the compact format to represent targets (see [CompactTarget]).

Note that this value differs from Bitcoin Core’s powLimit field in that this value is attainable, but Bitcoin Core’s is not. Specifically, because targets in Bitcoin are always rounded to the nearest float expressible in “compact form”, not all targets are attainable. Still, this should not affect consensus as the only place where the non-compact form of this is used in Bitcoin Core’s consensus algorithm is in comparison and there are no compact-expressible values between Bitcoin Core’s and the limit expressed here.

§pow_target_spacing: u64

Expected amount of time to mine one block.

§pow_target_timespan: u64

Difficulty recalculation interval.

§allow_min_difficulty_blocks: bool

Determines whether minimal difficulty may be used for blocks or not.

§no_pow_retargeting: bool

Determines whether retargeting is disabled for this network or not.

Implementations§

§

impl Params

pub const BITCOIN: Params = Params::MAINNET

The mainnet parameters (alias for Params::MAINNET).

pub const MAINNET: Params

The mainnet parameters.

pub const TESTNET: Params

👎Deprecated since 0.32.4: Use TESTNET3 instead

The testnet3 parameters.

pub const TESTNET3: Params

The testnet3 parameters.

pub const TESTNET4: Params

The testnet4 parameters.

pub const SIGNET: Params

The signet parameters.

pub const REGTEST: Params

The regtest parameters.

pub const fn new(network: Network) -> Params

Creates parameters set for the given network.

pub fn difficulty_adjustment_interval(&self) -> u64

Calculates the number of blocks between difficulty adjustments.

Trait Implementations§

§

impl AsRef<Params> for Network

§

fn as_ref(&self) -> &Params

Converts this type into a shared reference of the (usually inferred) input type.
§

impl AsRef<Params> for Params

§

fn as_ref(&self) -> &Params

Converts this type into a shared reference of the (usually inferred) input type.
§

impl Clone for Params

§

fn clone(&self) -> Params

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for Params

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl From<&Network> for &'static Params

§

fn from(value: &Network) -> &'static Params

Converts to this type from the input type.
§

impl From<&Network> for Params

§

fn from(value: &Network) -> Params

Converts to this type from the input type.
§

impl From<Network> for &'static Params

§

fn from(value: Network) -> &'static Params

Converts to this type from the input type.
§

impl From<Network> for Params

§

fn from(value: Network) -> Params

Converts to this type from the input type.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

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

§

fn vzip(self) -> V