zebra/zebra-network/src/network.rs

21 lines
540 B
Rust
Raw Normal View History

use crate::{constants::magics, protocol::external::types::Magic};
/// An enum describing the possible network choices.
2019-10-16 15:16:29 -07:00
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub enum Network {
/// The production mainnet.
Mainnet,
/// The testnet.
Testnet,
}
impl Network {
/// Get the magic value associated to this `Network`.
2020-02-04 22:53:24 -08:00
pub fn magic(self) -> Magic {
match self {
Network::Mainnet => magics::MAINNET,
Network::Testnet => magics::TESTNET,
}
}
}