From 3180efb635241cca1c2bf0f0ef1573dc084dc860 Mon Sep 17 00:00:00 2001 From: brianp Date: Wed, 12 Apr 2023 07:39:13 +0200 Subject: [PATCH] Define different network defaults for bins This commit make a simple switch to define Network::default differently for the different bins compiled for different networks. Making us one step closer to smarter defaults, and one click, out of the box. --- common/src/configuration/network.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/common/src/configuration/network.rs b/common/src/configuration/network.rs index ce9a600284..e04686d3bf 100644 --- a/common/src/configuration/network.rs +++ b/common/src/configuration/network.rs @@ -74,10 +74,21 @@ impl Network { /// The default network for all applications impl Default for Network { + #[cfg(tari_network_mainnet)] fn default() -> Self { // TODO: set the default network to mainnet Network::StageNet } + + #[cfg(tari_network_nextnet)] + fn default() -> Self { + Network::NextNet + } + + #[cfg(all(not(tari_network_mainnet), not(tari_network_nextnet)))] + fn default() -> Self { + Network::Esmeralda + } } impl FromStr for Network { @@ -195,7 +206,7 @@ mod test { #[test] fn network_default() { let network = Network::default(); - assert_eq!(network, Network::StageNet); + assert_eq!(network, Network::Esmeralda); } #[test]