add impl fmt::Debug for BlindingFactor, for pretty print (#1382)

This commit is contained in:
Gary Yu 2018-08-19 19:57:04 +08:00 committed by Antioch Peverell
parent 25e03aadef
commit 7d677737d7

View file

@ -162,9 +162,15 @@ impl fmt::Display for Identifier {
}
}
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Copy, PartialEq, Serialize, Deserialize)]
pub struct BlindingFactor([u8; SECRET_KEY_SIZE]);
impl fmt::Debug for BlindingFactor {
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.to_hex())
}
}
impl AsRef<[u8]> for BlindingFactor {
fn as_ref(&self) -> &[u8] {
&self.0
@ -297,8 +303,8 @@ mod test {
use rand::thread_rng;
use types::BlindingFactor;
use util::secp::Secp256k1;
use util::secp::key::{SecretKey, ZERO_KEY};
use util::secp::Secp256k1;
#[test]
fn split_blinding_factor() {