diff --git a/libs/sdk-core/src/breez_services.rs b/libs/sdk-core/src/breez_services.rs index 1ced7d546..153c337f1 100644 --- a/libs/sdk-core/src/breez_services.rs +++ b/libs/sdk-core/src/breez_services.rs @@ -185,8 +185,7 @@ impl BreezServices { req: ConnectRequest, event_listener: Box, ) -> BreezServicesResult> { - let sdk_version = option_env!("CARGO_PKG_VERSION").unwrap_or_default(); - let sdk_git_hash = option_env!("SDK_GIT_HASH").unwrap_or_default(); + let (sdk_version, sdk_git_hash) = Self::get_sdk_version(); info!("SDK v{sdk_version} ({sdk_git_hash})"); let start = Instant::now(); let services = BreezServicesBuilder::new(req.config) @@ -199,6 +198,12 @@ impl BreezServices { Ok(services) } + fn get_sdk_version() -> (&'static str, &'static str) { + let sdk_version = option_env!("CARGO_PKG_VERSION").unwrap_or_default(); + let sdk_git_hash = option_env!("SDK_GIT_HASH").unwrap_or_default(); + (sdk_version, sdk_git_hash) + } + /// Internal utility method that starts the BreezServices background tasks for this instance. /// /// It should be called once right after creating [BreezServices], since it is essential for the @@ -2168,6 +2173,8 @@ impl BreezServices { } async fn generate_sdk_diagnostic_data(&self) -> SdkResult { + let (sdk_version, sdk_git_hash) = Self::get_sdk_version(); + let version = format!("SDK v{sdk_version} ({sdk_git_hash})"); let state = crate::serializer::value::to_value(&self.persister.get_node_state()?)?; let payments = crate::serializer::value::to_value( &self @@ -2184,6 +2191,7 @@ impl BreezServices { let lsp_id = crate::serializer::value::to_value(&self.persister.get_lsp_id()?)?; let res = json!({ + "version": version, "node_state": state, "payments": payments, "channels": channels,