Add a Magic type for network magics.

This commit is contained in:
Henry de Valence 2019-09-13 05:28:38 -07:00 committed by Deirdre Connolly
parent 42cb9c1ff9
commit cf63f00171
2 changed files with 14 additions and 4 deletions

View File

@ -2,5 +2,14 @@
use crate::types::*;
/// The Zcash version used on mainnet.
pub const ZCASH_VERSION: Version = Version(170_007);
/// The Zcash network protocol version used on mainnet.
pub const CURRENT_VERSION: Version = Version(170_007);
/// Magic numbers used to identify different Zcash networks.
pub mod magics {
use super::*;
/// The production mainnet.
pub const MAINNET: Magic = Magic(0x6427e924);
/// The testnet.
pub const TESTNET: Magic = Magic(0xbff91afa);
}

View File

@ -1,8 +1,9 @@
//! Newtype wrappers assigning semantic meaning to primitive types.
use std::net::SocketAddr;
/// A magic number identifying the network.
pub struct Magic(pub u32);
/// A protocol version magic number.
/// A protocol version number.
pub struct Version(pub u32);
/// Bitfield of features to be enabled for this connection.