[ethkey] Unify debug/display for Address/Public/Secret (#8076)

* unify debug in ethkey

* fix tests
This commit is contained in:
Niklas Adolfsson
2018-03-09 16:32:20 +01:00
committed by Marek Kotewicz
parent e8106016c8
commit 29d7a0e3c9
2 changed files with 9 additions and 3 deletions

View File

@@ -34,6 +34,12 @@ impl ToHex for Secret {
}
impl fmt::Debug for Secret {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "{:?}", self.inner)
}
}
impl fmt::Display for Secret {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
write!(fmt, "Secret: 0x{:x}{:x}..{:x}{:x}", self.inner[0], self.inner[1], self.inner[30], self.inner[31])
}
@@ -168,7 +174,7 @@ impl Secret {
if self.is_zero() {
return Ok(());
}
match pow {
0 => *self = key::ONE_KEY.into(),
1 => (),