Skip to content

Commit

Permalink
PR fixes on documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
pacu committed Jan 11, 2024
1 parent 3e3640e commit f71a625
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
11 changes: 6 additions & 5 deletions zcash_primitives/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ 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`.
- `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 given `FullNodeParameters::Local(P)`
- `impl Parameters for LocalNetwork` that use provided activation heights and
default to `constants::regtest::` for everything else.
defaults to `constants::regtest::` for everything else.

### Changed
- `zcash_primitives::transaction`:
Expand Down
24 changes: 15 additions & 9 deletions zcash_primitives/src/local_consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,12 @@ use crate::{
constants,
};

/// Represents the Network Parameters of the Full Node the caller
/// would be connecting to.
/// `Consensus(Network::MainNetwork)` refers to a Zcash Full Node
/// running on public Mainnet
/// `Consensus(Network::TestNetwork)` refers to a Zcash Full Node
/// running on public Testnet
/// `Local(P)` can be used to define the consensus parameters of
/// a local or non-public network like one or more nodes on
/// `regtest` mode.
/// 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),
}

Expand Down Expand Up @@ -63,6 +58,17 @@ pub struct LocalNetwork {
pub z_future: Option<BlockHeight>,
}

/// 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()
/// ```
impl Parameters for LocalNetwork {
fn activation_height(&self, nu: NetworkUpgrade) -> Option<BlockHeight> {
match nu {
Expand Down

0 comments on commit f71a625

Please sign in to comment.