From f5ae49f07186bab3b2db47fa1227fc681ffc90f5 Mon Sep 17 00:00:00 2001 From: Eugene P Date: Thu, 10 Jan 2019 06:28:15 +0300 Subject: [PATCH] Print block hash in TUI partially --- src/bin/tui/mining.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bin/tui/mining.rs b/src/bin/tui/mining.rs index 5cf6f1d49..b2efcbb2b 100644 --- a/src/bin/tui/mining.rs +++ b/src/bin/tui/mining.rs @@ -137,7 +137,13 @@ impl TableViewItem for DiffBlock { match column { DiffColumn::Height => self.block_height.to_string(), - DiffColumn::Hash => self.block_hash.to_string(), + DiffColumn::Hash => { // Prints part of the hash's hex + let hash_hex = self.block_hash.to_hex(); + let len = hash_hex.len(); + const NUM_SHOW: usize = 8; // Number of characters to show + + format!("{}...{}", &hash_hex[..NUM_SHOW / 2], &hash_hex[(len - NUM_SHOW)..]) + }, DiffColumn::PoWType => pow_type, DiffColumn::Difficulty => self.difficulty.to_string(), DiffColumn::SecondaryScaling => self.secondary_scaling.to_string(),