Skip to content

Commit

Permalink
fix: base node write tor address (#6210)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
SWvheerden authored Mar 20, 2024
1 parent 7665067 commit 019a909
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions applications/minotari_node/src/bootstrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 {
Expand Down

0 comments on commit 019a909

Please sign in to comment.