From 64b353f069f65213c5278e30e3c48df73c9a3409 Mon Sep 17 00:00:00 2001 From: Revertron Date: Sat, 17 Apr 2021 13:15:53 +0200 Subject: [PATCH] Added a workaround for old domains, that have old name encryption. --- src/blockchain/chain.rs | 8 ++++---- src/web_ui.rs | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/blockchain/chain.rs b/src/blockchain/chain.rs index fd1d1f3..08ff616 100644 --- a/src/blockchain/chain.rs +++ b/src/blockchain/chain.rs @@ -414,7 +414,7 @@ impl Chain { Ok(mut statement) => { while statement.next().unwrap() == State::Row { let data = statement.read::(0).unwrap(); - debug!("Got zone data {}", &data); + //debug!("Got zone data {}", &data); if let Ok(zone_data) = serde_json::from_str::(&data) { map.insert(zone_data.name.clone(), zone_data); } @@ -522,7 +522,7 @@ impl Chain { } } - pub fn get_my_domains(&self, keystore: &Option) -> HashMap { + pub fn get_my_domains(&self, keystore: &Option) -> HashMap { if keystore.is_none() { return HashMap::new(); } @@ -540,7 +540,7 @@ impl Chain { let class = String::from("domain"); let data = statement.read::(4).unwrap(); let pub_key = Bytes::from_bytes(&statement.read::>(5).unwrap()); - let transaction = Transaction { identity, confirmation, class, data, pub_key }; + let transaction = Transaction { identity: identity.clone(), confirmation, class, data, pub_key }; //debug!("Found transaction for domain {}: {:?}", domain, &transaction); if let Some(data) = transaction.get_domain_data() { let b = self.get_block(index - 1).unwrap(); @@ -550,7 +550,7 @@ impl Chain { domain = String::from("unknown"); } trace!("Found my domain {}", domain); - result.insert(domain, (timestamp, data)); + result.insert(identity, (domain, timestamp, data)); } } result diff --git a/src/web_ui.rs b/src/web_ui.rs index a4026be..a74b280 100644 --- a/src/web_ui.rs +++ b/src/web_ui.rs @@ -327,8 +327,8 @@ fn load_domains(context: &mut MutexGuard, handle: &Handle<()>) { web_view.eval("clearMyDomains();") }); let domains = context.chain.get_my_domains(&context.keystore); - debug!("Domains: {:?}", &domains); - for (domain, (timestamp, data)) in domains { + debug!("Domains: {:?}", &domains.values()); + for (_identity, (domain, timestamp, data)) in domains { let d = serde_json::to_string(&data).unwrap(); let command = format!("addMyDomain('{}', {}, '{}');", &domain, timestamp, &d); let _ = handle.dispatch(move |web_view|{