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