network: add Network::default_port().

This commit is contained in:
Henry de Valence 2020-09-04 10:19:20 -07:00
parent 9682d452ee
commit ea6017d0dc
1 changed files with 10 additions and 0 deletions

View File

@ -11,6 +11,16 @@ pub enum Network {
Testnet,
}
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