pub enum BranchId {
Sprout,
Overwinter,
Sapling,
Blossom,
Heartwood,
Canopy,
Nu5,
Nu6,
}
Expand description
A globally-unique identifier for a set of consensus rules within the Zcash chain.
Each branch ID in this enum corresponds to one of the epochs between a pair of Zcash
network upgrades. For example, BranchId::Overwinter
corresponds to the blocks
starting at Overwinter activation, and ending the block before Sapling activation.
The main use of the branch ID is in signature generation: transactions commit to a
specific branch ID by including it as part of signature_hash
. This ensures
two-way replay protection for transactions across network upgrades.
See ZIP 200 for more details.
Variants§
Sprout
The consensus rules at the launch of Zcash.
Overwinter
The consensus rules deployed by NetworkUpgrade::Overwinter
.
Sapling
The consensus rules deployed by NetworkUpgrade::Sapling
.
Blossom
The consensus rules deployed by NetworkUpgrade::Blossom
.
Heartwood
The consensus rules deployed by NetworkUpgrade::Heartwood
.
Canopy
The consensus rules deployed by NetworkUpgrade::Canopy
.
Nu5
The consensus rules deployed by NetworkUpgrade::Nu5
.
Nu6
The consensus rules deployed by NetworkUpgrade::Nu6
.
Implementations§
Source§impl BranchId
impl BranchId
Sourcepub fn for_height<P: Parameters>(parameters: &P, height: BlockHeight) -> Self
pub fn for_height<P: Parameters>(parameters: &P, height: BlockHeight) -> Self
Returns the branch ID corresponding to the consensus rule set that is active at the given height.
This is the branch ID that should be used when creating transactions.
Sourcepub fn height_range<P: Parameters>(
&self,
params: &P,
) -> Option<impl RangeBounds<BlockHeight>>
pub fn height_range<P: Parameters>( &self, params: &P, ) -> Option<impl RangeBounds<BlockHeight>>
Returns the range of heights for the consensus epoch associated with this branch id.
The resulting tuple implements the RangeBounds<BlockHeight>
trait.
Sourcepub fn height_bounds<P: Parameters>(
&self,
params: &P,
) -> Option<(BlockHeight, Option<BlockHeight>)>
pub fn height_bounds<P: Parameters>( &self, params: &P, ) -> Option<(BlockHeight, Option<BlockHeight>)>
Returns the range of heights for the consensus epoch associated with this branch id.
The return type of this value is slightly more precise than Self::height_range
:
Some((x, Some(y)))
means that the consensus rules corresponding to this branch id are in effect for the rangex..y
Some((x, None))
means that the consensus rules corresponding to this branch id are in effect for the rangex..
None
means that the consensus rules corresponding to this branch id are never in effect.
pub fn sprout_uses_groth_proofs(&self) -> bool
Trait Implementations§
impl Copy for BranchId
impl Eq for BranchId
impl StructuralPartialEq for BranchId
Auto Trait Implementations§
impl Freeze for BranchId
impl RefUnwindSafe for BranchId
impl Send for BranchId
impl Sync for BranchId
impl Unpin for BranchId
impl UnwindSafe for BranchId
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<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 more