From 5611b05118739d85d0b1e76562c3c3f84d317e88 Mon Sep 17 00:00:00 2001 From: Stanimal Date: Thu, 22 Jul 2021 19:08:21 +0400 Subject: [PATCH] fix: bug that causes non p2p apps to panic on startup Exclude non p2p apps from needing comms configuration --- common/src/configuration/global.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/common/src/configuration/global.rs b/common/src/configuration/global.rs index 604811c6d9..ecaf67bce5 100644 --- a/common/src/configuration/global.rs +++ b/common/src/configuration/global.rs @@ -762,9 +762,17 @@ where fn network_transport_config( cfg: &Config, - application: ApplicationType, + mut application: ApplicationType, network: &str, ) -> Result { + const P2P_APPS: &[ApplicationType] = &[ApplicationType::BaseNode, ApplicationType::ConsoleWallet]; + if !P2P_APPS.contains(&application) { + // TODO: If/when we split the configs by app, this hack can be removed + // This removed the need to setup defaults for apps that dont use the network, + // assuming base node has been set up + application = ApplicationType::BaseNode; + } + let get_conf_str = |key| { cfg.get_str(key) .map_err(|err| ConfigurationError::new(key, &err.to_string()))