mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 11:31:08 +03:00
Show first 12 digits of Hash
This commit is contained in:
parent
b4e4992a5c
commit
faff529260
1 changed files with 2 additions and 6 deletions
|
@ -48,13 +48,9 @@ impl fmt::Debug for Hash {
|
||||||
impl fmt::Display for Hash {
|
impl fmt::Display for Hash {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
let hash_hex = self.to_hex();
|
let hash_hex = self.to_hex();
|
||||||
let len = hash_hex.len();
|
const NUM_SHOW: usize = 12;
|
||||||
const NUM_SHOW: usize = 8;
|
|
||||||
|
|
||||||
let starting = &hash_hex[..NUM_SHOW];
|
write!(f, "{}...", &hash_hex[..NUM_SHOW])
|
||||||
let ending = &hash_hex[(len - NUM_SHOW)..];
|
|
||||||
|
|
||||||
write!(f, "{}...{}", starting, ending)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue