network: add Network::default_port().
@@ -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
