Skip to content

Commit

Permalink
fix: fix Tor ID deserialization issue
Browse files Browse the repository at this point in the history
Due to an issue with excluding the private key from the TorIdentity serialization that was fixed in tari-project#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.
  • Loading branch information
philipr-za committed Mar 23, 2022
1 parent a68614e commit 6de4bdc
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 6de4bdc

Please sign in to comment.