From 6de4bdc18093037a727a7f0df0a798fe566f7e8d Mon Sep 17 00:00:00 2001 From: Philip Date: Wed, 23 Mar 2022 12:07:53 +0000 Subject: [PATCH] fix: fix Tor ID deserialization issue Due to an issue with excluding the private key from the TorIdentity serialization that was fixed in https://github.com/tari-project/tari/pull/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. --- .../tari_console_wallet/src/init/mod.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/applications/tari_console_wallet/src/init/mod.rs b/applications/tari_console_wallet/src/init/mod.rs index 650e3cf271..e7b2fd5fed 100644 --- a/applications/tari_console_wallet/src/init/mod.rs +++ b/applications/tari_console_wallet/src/init/mod.rs @@ -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, };