Skip to content

Commit

Permalink
fix: fix Tor ID deserialization issue (#3950)
Browse files Browse the repository at this point in the history
Description
---
Due to an issue with excluding the private key from the TorIdentity serialization that was fixed in #3946 any console wallets that ran the old code would crash on startup with a serialization error.

This PR adds some resilience to the startup process that if it cannot deserialize the old Tor Id it will log the issue and then use a newly generated one.

How Has This Been Tested?
---
Manually
  • Loading branch information
philipr-za committed Mar 24, 2022
1 parent 1c7adc0 commit c290ab9
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions applications/tari_console_wallet/src/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,19 @@ pub async fn init_wallet(
}

let transport_type = create_transport_type(config);
let transport_type = match transport_type {
Tor(mut tor_config) => {
tor_config.identity = wallet_db.get_tor_id().await?.map(Box::new);
Tor(tor_config)
let transport_type = match transport_type.clone() {
Tor(mut tor_config) => match wallet_db.get_tor_id().await {
Ok(identity) => {
tor_config.identity = identity.map(Box::new);
Tor(tor_config)
},
Err(e) => {
warn!(
target: LOG_TARGET,
"Error reading stored Tor Identity, using default: {}", e
);
transport_type
},
},
_ => transport_type,
};
Expand Down

0 comments on commit c290ab9

Please sign in to comment.