From 2873d14a980f371768a62d349b04e9cb63b5d47c Mon Sep 17 00:00:00 2001 From: Yoni Date: Sat, 12 Jan 2019 17:19:30 +0200 Subject: [PATCH 1/5] Remvoe 3 dots from hash formatting --- core/src/core/hash.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/core/hash.rs b/core/src/core/hash.rs index 378940436..446ee8910 100644 --- a/core/src/core/hash.rs +++ b/core/src/core/hash.rs @@ -41,7 +41,7 @@ impl fmt::Debug for Hash { let hash_hex = self.to_hex(); const NUM_SHOW: usize = 12; - write!(f, "{}...", &hash_hex[..NUM_SHOW]) + write!(f, "{}", &hash_hex[..NUM_SHOW]) } } From 383d35950e12303d71f38d3355b6320a0a475c89 Mon Sep 17 00:00:00 2001 From: Yoni Date: Sat, 12 Jan 2019 17:22:35 +0200 Subject: [PATCH 2/5] Move 3 dots to the TUI --- src/bin/tui/status.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/tui/status.rs b/src/bin/tui/status.rs index 45d81e03b..afc92cd17 100644 --- a/src/bin/tui/status.rs +++ b/src/bin/tui/status.rs @@ -241,7 +241,7 @@ impl TUIStatusListener for TUIStatusView { t.set_content(stats.peer_count.to_string()); }); c.call_on_id("tip_hash", |t: &mut TextView| { - t.set_content(stats.head.last_block_h.to_string()); + t.set_content(stats.head.last_block_h.to_string() + "..."); }); c.call_on_id("chain_height", |t: &mut TextView| { t.set_content(stats.head.height.to_string()); @@ -250,7 +250,7 @@ impl TUIStatusListener for TUIStatusView { t.set_content(stats.head.total_difficulty.to_string()); }); c.call_on_id("basic_header_tip_hash", |t: &mut TextView| { - t.set_content(stats.header_head.last_block_h.to_string()); + t.set_content(stats.header_head.last_block_h.to_string() + "..."); }); c.call_on_id("basic_header_chain_height", |t: &mut TextView| { t.set_content(stats.header_head.height.to_string()); From c70f5caf03f96831daa3240804180ee36dbe3ad9 Mon Sep 17 00:00:00 2001 From: Yoni Date: Sat, 12 Jan 2019 20:17:46 +0200 Subject: [PATCH 3/5] Add backwards check --- store/src/pmmr.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/store/src/pmmr.rs b/store/src/pmmr.rs index bf3986a74..2148ff681 100644 --- a/store/src/pmmr.rs +++ b/store/src/pmmr.rs @@ -193,7 +193,13 @@ impl PMMRBackend { data_dir.join(PMMR_LEAF_FILE).to_str().unwrap(), header.hash() ); - LeafSet::copy_snapshot(&leaf_set_path, &PathBuf::from(leaf_snapshot_path))?; + // Check for a ... (3 dot) ending version of the file - could probably be removed after mainnet + let compaitble_snapshot_path = PathBuf::from(leaf_snapshot_path.clone() + "..."); + if compaitble_snapshot_path.exists() { + LeafSet::copy_snapshot(&leaf_set_path, &compaitble_snapshot_path)?; + } else { + LeafSet::copy_snapshot(&leaf_set_path, &PathBuf::from(leaf_snapshot_path))?; + } } let leaf_set = LeafSet::open(&leaf_set_path)?; From 51ad71106344314542e08a528f74183e068e3a74 Mon Sep 17 00:00:00 2001 From: Yoni Date: Sat, 12 Jan 2019 21:11:03 +0200 Subject: [PATCH 4/5] Add triple dot to check_and_remove_files + typo --- chain/src/txhashset/txhashset.rs | 4 +++- store/src/pmmr.rs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/chain/src/txhashset/txhashset.rs b/chain/src/txhashset/txhashset.rs index 0ed33e087..45ee95cc7 100644 --- a/chain/src/txhashset/txhashset.rs +++ b/chain/src/txhashset/txhashset.rs @@ -1451,7 +1451,7 @@ fn check_and_remove_files(txhashset_path: &PathBuf, header: &BlockHeader) -> Res } // Then compare the files found in the subdirectories - let pmmr_files_expected: HashSet<_> = PMMR_FILES + let mut pmmr_files_expected: HashSet<_> = PMMR_FILES .iter() .cloned() .map(|s| { @@ -1462,6 +1462,8 @@ fn check_and_remove_files(txhashset_path: &PathBuf, header: &BlockHeader) -> Res } }) .collect(); + // prevent checker from deleting 3 dot file, could be removed after mainnet + pmmr_files_expected.insert(format!("pmmr_leaf.bin.{}...", header.hash())); let subdirectories = fs::read_dir(txhashset_path)?; for subdirectory in subdirectories { diff --git a/store/src/pmmr.rs b/store/src/pmmr.rs index 2148ff681..d22f435cc 100644 --- a/store/src/pmmr.rs +++ b/store/src/pmmr.rs @@ -194,8 +194,8 @@ impl PMMRBackend { header.hash() ); // Check for a ... (3 dot) ending version of the file - could probably be removed after mainnet - let compaitble_snapshot_path = PathBuf::from(leaf_snapshot_path.clone() + "..."); - if compaitble_snapshot_path.exists() { + let compatible_snapshot_path = PathBuf::from(leaf_snapshot_path.clone() + "..."); + if compatible_snapshot_path.exists() { LeafSet::copy_snapshot(&leaf_set_path, &compaitble_snapshot_path)?; } else { LeafSet::copy_snapshot(&leaf_set_path, &PathBuf::from(leaf_snapshot_path))?; From b39ce8d3280d68fd97c4b4a88f68198266a34921 Mon Sep 17 00:00:00 2001 From: Yoni Date: Sat, 12 Jan 2019 21:24:31 +0200 Subject: [PATCH 5/5] typo --- store/src/pmmr.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store/src/pmmr.rs b/store/src/pmmr.rs index d22f435cc..c6cf6b6c2 100644 --- a/store/src/pmmr.rs +++ b/store/src/pmmr.rs @@ -196,7 +196,7 @@ impl PMMRBackend { // Check for a ... (3 dot) ending version of the file - could probably be removed after mainnet let compatible_snapshot_path = PathBuf::from(leaf_snapshot_path.clone() + "..."); if compatible_snapshot_path.exists() { - LeafSet::copy_snapshot(&leaf_set_path, &compaitble_snapshot_path)?; + LeafSet::copy_snapshot(&leaf_set_path, &compatible_snapshot_path)?; } else { LeafSet::copy_snapshot(&leaf_set_path, &PathBuf::from(leaf_snapshot_path))?; }