zebra/zebra-chain/src/parameters/network.rs

29 lines
628 B
Rust
Raw Normal View History

#[cfg(test)]
use proptest_derive::Arbitrary;
/// An enum describing the possible network choices.
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
#[cfg_attr(test, derive(Arbitrary))]
pub enum Network {
/// The production mainnet.
Mainnet,
/// The testnet.
Testnet,
}
2020-09-04 10:19:20 -07:00
impl Network {
/// Get the default port associated to this network.
pub fn default_port(&self) -> u16 {
match self {
Network::Mainnet => 8233,
Network::Testnet => 18233,
}
}
}
impl Default for Network {
fn default() -> Self {
Network::Mainnet
}
}