From 019a9093c450157d3a00661b0330c21f394c5a5f Mon Sep 17 00:00:00 2001 From: SW van Heerden Date: Wed, 20 Mar 2024 09:47:19 +0200 Subject: [PATCH] fix: base node write tor address (#6210) Description --- Base will now write tor address in the identity file Motivation and Context --- The base node needs to contain the tor address. How Has This Been Tested? --- manual --- applications/minotari_node/src/bootstrap.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/applications/minotari_node/src/bootstrap.rs b/applications/minotari_node/src/bootstrap.rs index 45fa169623..dc76aa290f 100644 --- a/applications/minotari_node/src/bootstrap.rs +++ b/applications/minotari_node/src/bootstrap.rs @@ -174,11 +174,12 @@ where B: BlockchainBackend + 'static let comms = Self::setup_rpc_services(comms, &handles, self.db.into(), &p2p_config); let comms = if p2p_config.transport.transport_type == TransportType::Tor { - let path = base_node_config.tor_identity_file.clone(); + let tor_id_path = base_node_config.tor_identity_file.clone(); + let node_id_path = base_node_config.identity_file.clone(); let node_id = comms.node_identity(); let after_comms = move |identity: TorIdentity| { let address_string = format!("/onion3/{}:{}", identity.service_id, identity.onion_port); - if let Err(e) = identity_management::save_as_json(&path, &identity) { + if let Err(e) = identity_management::save_as_json(&tor_id_path, &identity) { error!(target: LOG_TARGET, "Failed to save tor identity{:?}", e); } trace!(target: LOG_TARGET, "resave the tor identity {:?}", identity); @@ -191,6 +192,9 @@ where B: BlockchainBackend + 'static if !node_id.public_addresses().contains(&address) { node_id.add_public_address(address); } + if let Err(e) = identity_management::save_as_json(&node_id_path, &*node_id) { + error!(target: LOG_TARGET, "Failed to save node identity identity{:?}", e); + } }; initialization::spawn_comms_using_transport(comms, p2p_config.transport.clone(), after_comms).await } else {