pub enum Network {
Mainnet,
Testnet(Arc<Parameters>),
}Expand description
An enum describing the possible network choices.
Variants§
Mainnet
The production mainnet.
Testnet(Arc<Parameters>)
A test network such as the default public testnet, a configured testnet, or Regtest.
Implementations§
Source§impl Network
impl Network
Sourcepub fn genesis_hash(&self) -> Hash
pub fn genesis_hash(&self) -> Hash
Returns the hash for the genesis block in network.
Sourcepub fn checkpoint_list(&self) -> Arc<CheckpointList>
pub fn checkpoint_list(&self) -> Arc<CheckpointList>
Returns the hard-coded checkpoint list for network.
Source§impl Network
impl Network
Sourcepub fn parameters(&self) -> Option<Arc<Parameters>>
pub fn parameters(&self) -> Option<Arc<Parameters>>
Returns the parameters of this network if it is a Testnet.
Sourcepub fn disable_pow(&self) -> bool
pub fn disable_pow(&self) -> bool
Returns true if proof-of-work validation should be disabled for this network
Sourcepub fn slow_start_interval(&self) -> Height
pub fn slow_start_interval(&self) -> Height
Returns slow start interval for this network
Sourcepub fn slow_start_shift(&self) -> Height
pub fn slow_start_shift(&self) -> Height
Returns slow start shift for this network
Sourcepub fn funding_streams(&self, height: Height) -> Option<&FundingStreams>
pub fn funding_streams(&self, height: Height) -> Option<&FundingStreams>
Returns post-Canopy funding streams for this network at the provided height
Sourcepub fn all_funding_streams(&self) -> &Vec<FundingStreams>
pub fn all_funding_streams(&self) -> &Vec<FundingStreams>
Returns post-Canopy funding streams for this network at the provided height
Sourcepub fn should_allow_unshielded_coinbase_spends(&self) -> bool
pub fn should_allow_unshielded_coinbase_spends(&self) -> bool
Returns true if this network should allow transactions with transparent outputs that spend coinbase outputs.
Source§impl Network
impl Network
Sourcepub fn new_default_testnet() -> Self
pub fn new_default_testnet() -> Self
Creates a new Network::Testnet with the default Testnet testnet::Parameters.
Sourcepub fn new_configured_testnet(params: Parameters) -> Self
pub fn new_configured_testnet(params: Parameters) -> Self
Creates a new configured Network::Testnet with the provided Testnet testnet::Parameters.
Sourcepub fn new_regtest(params: RegtestParameters) -> Self
pub fn new_regtest(params: RegtestParameters) -> Self
Creates a new Network::Testnet with Regtest parameters and the provided network upgrade activation heights.
Sourcepub fn is_default_testnet(&self) -> bool
pub fn is_default_testnet(&self) -> bool
Returns true if the network is the default Testnet, or false otherwise.
Sourcepub fn is_regtest(&self) -> bool
pub fn is_regtest(&self) -> bool
Returns true if the network is Regtest, or false otherwise.
Sourcepub fn kind(&self) -> NetworkKind
pub fn kind(&self) -> NetworkKind
Returns the NetworkKind for this network.
Sourcepub fn t_addr_kind(&self) -> NetworkKind
pub fn t_addr_kind(&self) -> NetworkKind
Returns NetworkKind::Testnet on Testnet and Regtest, or NetworkKind::Mainnet on Mainnet.
This is used for transparent addresses, as the address prefix is the same on Regtest as it is on Testnet.
Sourcepub fn is_max_block_time_enforced(&self, height: Height) -> bool
pub fn is_max_block_time_enforced(&self, height: Height) -> bool
Returns true if the maximum block time rule is active for network and height.
Always returns true if network is the Mainnet.
If network is the Testnet, the height should be at least
TESTNET_MAX_TIME_START_HEIGHT to return true.
Returns false otherwise.
Part of the consensus rules at https://zips.z.cash/protocol/protocol.pdf#blockheader
Sourcepub fn default_port(&self) -> u16
pub fn default_port(&self) -> u16
Get the default port associated to this network.
Sourcepub fn mandatory_checkpoint_height(&self) -> Height
pub fn mandatory_checkpoint_height(&self) -> Height
Get the mandatory minimum checkpoint height for this network.
Mandatory checkpoints are a Zebra-specific feature. If a Zcash consensus rule only applies before the mandatory checkpoint, Zebra can skip validation of that rule. This is necessary because Zebra can’t fully validate the blocks prior to Canopy.
Sourcepub fn bip70_network_name(&self) -> String
pub fn bip70_network_name(&self) -> String
Return the network name as defined in BIP70
Sourcepub fn lowercase_name(&self) -> String
pub fn lowercase_name(&self) -> String
Return the lowercase network name.
Sourcepub fn is_a_test_network(&self) -> bool
pub fn is_a_test_network(&self) -> bool
Returns true if this network is a testing network.
Sourcepub fn sapling_activation_height(&self) -> Height
pub fn sapling_activation_height(&self) -> Height
Returns the Sapling activation height for this network.
Sourcepub fn lockbox_disbursement_total_amount(
&self,
height: Height,
) -> Amount<NonNegative>
pub fn lockbox_disbursement_total_amount( &self, height: Height, ) -> Amount<NonNegative>
Returns the expected total value of the sum of all NU6.1 one-time lockbox disbursement output values for this network at the provided height.
Sourcepub fn lockbox_disbursements(
&self,
height: Height,
) -> Vec<(Address, Amount<NonNegative>)>
pub fn lockbox_disbursements( &self, height: Height, ) -> Vec<(Address, Amount<NonNegative>)>
Returns the expected NU6.1 lockbox disbursement outputs for this network at the provided height.
Source§impl Network
impl Network
Sourcepub fn activation_list(&self) -> BTreeMap<Height, NetworkUpgrade>
pub fn activation_list(&self) -> BTreeMap<Height, NetworkUpgrade>
Returns a map between activation heights and network upgrades for network,
in ascending height order.
If the activation height of a future upgrade is not known, that network upgrade does not appear in the list.
This is actually a bijective map.
Note: This skips implicit network upgrade activations, use Network::full_activation_list
to get an explicit list of all network upgrade activations.
Sourcepub fn full_activation_list(&self) -> Vec<(Height, NetworkUpgrade)>
pub fn full_activation_list(&self) -> Vec<(Height, NetworkUpgrade)>
Returns a vector of all implicit and explicit network upgrades for network,
in ascending height order.
Trait Implementations§
Source§impl From<&Network> for NetworkKind
impl From<&Network> for NetworkKind
Source§impl From<Network> for NetworkKind
impl From<Network> for NetworkKind
Source§impl ParameterDifficulty for Network
impl ParameterDifficulty for Network
Source§fn target_difficulty_limit(&self) -> ExpandedDifficulty
fn target_difficulty_limit(&self) -> ExpandedDifficulty
Returns the easiest target difficulty allowed on network.
See ParameterDifficulty::target_difficulty_limit
Source§impl ParameterSubsidy for Network
Network methods related to Block Subsidy and Funding Streams
impl ParameterSubsidy for Network
Network methods related to Block Subsidy and Funding Streams
Source§fn height_for_first_halving(&self) -> Height
fn height_for_first_halving(&self) -> Height
Source§fn post_blossom_halving_interval(&self) -> HeightDiff
fn post_blossom_halving_interval(&self) -> HeightDiff
Source§fn pre_blossom_halving_interval(&self) -> HeightDiff
fn pre_blossom_halving_interval(&self) -> HeightDiff
Source§fn funding_stream_address_change_interval(&self) -> HeightDiff
fn funding_stream_address_change_interval(&self) -> HeightDiff
Source§impl Parameters for Network
impl Parameters for Network
Source§fn network_type(&self) -> NetworkType
fn network_type(&self) -> NetworkType
Source§fn activation_height(&self, nu: NetworkUpgrade) -> Option<BlockHeight>
fn activation_height(&self, nu: NetworkUpgrade) -> Option<BlockHeight>
Source§fn is_nu_active(&self, nu: NetworkUpgrade, height: BlockHeight) -> bool
fn is_nu_active(&self, nu: NetworkUpgrade, height: BlockHeight) -> bool
impl Eq for Network
impl StructuralPartialEq for Network
Auto Trait Implementations§
impl Freeze for Network
impl RefUnwindSafe for Network
impl Send for Network
impl Sync for Network
impl Unpin for Network
impl UnwindSafe for Network
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<P> NetworkConstants for Pwhere
P: Parameters,
impl<P> NetworkConstants for Pwhere
P: Parameters,
Source§fn hrp_sapling_extended_spending_key(&self) -> &'static str
fn hrp_sapling_extended_spending_key(&self) -> &'static str
Source§fn hrp_sapling_extended_full_viewing_key(&self) -> &'static str
fn hrp_sapling_extended_full_viewing_key(&self) -> &'static str
Source§fn hrp_sapling_payment_address(&self) -> &'static str
fn hrp_sapling_payment_address(&self) -> &'static str
Source§fn b58_sprout_address_prefix(&self) -> [u8; 2]
fn b58_sprout_address_prefix(&self) -> [u8; 2]
Source§fn b58_pubkey_address_prefix(&self) -> [u8; 2]
fn b58_pubkey_address_prefix(&self) -> [u8; 2]
Source§fn b58_secret_key_prefix(&self) -> [u8; 1]
fn b58_secret_key_prefix(&self) -> [u8; 1]
Source§fn b58_script_address_prefix(&self) -> [u8; 2]
fn b58_script_address_prefix(&self) -> [u8; 2]
Source§fn hrp_tex_address(&self) -> &'static str
fn hrp_tex_address(&self) -> &'static str
NetworkConstants value applies. Read moreSource§fn hrp_unified_address(&self) -> &'static str
fn hrp_unified_address(&self) -> &'static str
Source§fn hrp_unified_fvk(&self) -> &'static str
fn hrp_unified_fvk(&self) -> &'static str
Source§fn hrp_unified_ivk(&self) -> &'static str
fn hrp_unified_ivk(&self) -> &'static str
Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.