Add Display and LowerHex to TweakedPublicKey
This commit is contained in:
parent
ed40f3d3a6
commit
37352d1df5
|
@ -21,6 +21,7 @@ pub use secp256k1::schnorrsig::{PublicKey, KeyPair};
|
||||||
use secp256k1::{Secp256k1, Verification};
|
use secp256k1::{Secp256k1, Verification};
|
||||||
use hashes::Hash;
|
use hashes::Hash;
|
||||||
use util::taproot::{TapBranchHash, TapTweakHash};
|
use util::taproot::{TapBranchHash, TapTweakHash};
|
||||||
|
use core::fmt;
|
||||||
|
|
||||||
/// Untweaked Schnorr public key
|
/// Untweaked Schnorr public key
|
||||||
pub type UntweakedPublicKey = PublicKey;
|
pub type UntweakedPublicKey = PublicKey;
|
||||||
|
@ -29,6 +30,18 @@ pub type UntweakedPublicKey = PublicKey;
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct TweakedPublicKey(PublicKey);
|
pub struct TweakedPublicKey(PublicKey);
|
||||||
|
|
||||||
|
impl fmt::LowerHex for TweakedPublicKey {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
fmt::LowerHex::fmt(&self.0, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for TweakedPublicKey {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
fmt::Display::fmt(&self.0, f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A trait for tweaking Schnorr public keys
|
/// A trait for tweaking Schnorr public keys
|
||||||
pub trait TapTweak {
|
pub trait TapTweak {
|
||||||
/// Tweaks an untweaked public key given an untweaked key and optional script tree merkle root.
|
/// Tweaks an untweaked public key given an untweaked key and optional script tree merkle root.
|
||||||
|
|
Loading…
Reference in New Issue