PR Suggestion by @nuttycom: remove the `FullNodeParameters` enum
This commit is contained in:
parent
529fd3d562
commit
17f074d460
|
@ -56,12 +56,10 @@ and this library adheres to Rust's notion of
|
|||
- `impl From<TxId> for [u8; 32]`
|
||||
- Added feature `local-consensus` to crate `zcash_primitives`
|
||||
- Adds `pub mod local_consensus`
|
||||
- `local_consensus::FullNodeParameters` adds functionality to refer to Full Node
|
||||
parameters that can be either (public) Consensus nodes like `Network::MainNetwork`
|
||||
or `Network::TestNetwork`, or a `Local(P)` with a set of Parameters `P`. `Regtest`
|
||||
is considered a `LocalConsensus`.
|
||||
- `zcash_primitives::local_consensus::LocalNetwork` provides a type for specifying
|
||||
network upgrade activation heights for a given `FullNodeParameters::Local(P)`
|
||||
network upgrade activation heights for a local or specific configuration of a full
|
||||
node. Developers can make use of this type when connecting to a Regtest node by
|
||||
replicating the activation heights used on their node configuration.
|
||||
- `impl Parameters for LocalNetwork` that use provided activation heights and
|
||||
defaults to `constants::regtest::` for everything else.
|
||||
|
||||
|
|
|
@ -1,17 +1,8 @@
|
|||
use crate::{
|
||||
consensus::{BlockHeight, Network, NetworkUpgrade, Parameters},
|
||||
consensus::{BlockHeight, NetworkUpgrade, Parameters},
|
||||
constants,
|
||||
};
|
||||
|
||||
/// Represents the Network Parameters of the Full Node the caller connects to.
|
||||
pub enum FullNodeParameters<P: Parameters> {
|
||||
/// Variant indicating a Zcash Full Node running on public Mainnet or Testnet
|
||||
Consensus(Network),
|
||||
/// The consensus parameters of a local or non-public network like one or more nodes
|
||||
/// in `regtest` mode.
|
||||
Local(P),
|
||||
}
|
||||
|
||||
/// a `LocalNetwork` setup should define the activation heights
|
||||
/// of network upgrades. `None` is considered as "not activated"
|
||||
/// These heights are not validated. Callers shall initialized
|
||||
|
@ -60,15 +51,10 @@ pub struct LocalNetwork {
|
|||
|
||||
/// Parameters default implementation for `LocalNetwork`
|
||||
/// Important note:
|
||||
/// The following functions return `constants::regtest` values
|
||||
/// ```
|
||||
/// fn coin_type()
|
||||
/// fn address_network()
|
||||
/// fn hrp_sapling_extended_spending_key()
|
||||
/// fn hrp_sapling_extended_full_viewing_key()
|
||||
/// fn hrp_sapling_payment_address()
|
||||
/// fn b58_script_address_prefix()
|
||||
/// ```
|
||||
/// The functions `coin_type()`, `address_network()`,
|
||||
/// `hrp_sapling_extended_spending_key()`, `hrp_sapling_extended_full_viewing_key()`,
|
||||
/// `hrp_sapling_payment_address()`, `b58_script_address_prefix()` return
|
||||
/// `constants::regtest` values
|
||||
impl Parameters for LocalNetwork {
|
||||
fn activation_height(&self, nu: NetworkUpgrade) -> Option<BlockHeight> {
|
||||
match nu {
|
||||
|
|
Loading…
Reference in New Issue