Created
July 24, 2019 01:04
-
-
Save sanket1729/8a7b6949118f4fca1b238405fc9203ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub trait ToPkh{ | |
fn to_pkh(&self) -> hash160::Hash; | |
} | |
impl ToPkh for hash160::Hash{ | |
fn to_pkh(&self) -> hash160::Hash{ | |
*self | |
} | |
} | |
pub trait PublicKey: Clone + Eq + Ord + str::FromStr + fmt::Debug +fmt::Display { | |
type Hash: Clone + Eq + Ord + str::FromStr + fmt::Display + fmt::Debug + ToPkh; | |
///Converts an object to PublicHash | |
fn to_pubkeyhash(&self) -> Result<Self::Hash, Error>; | |
/// Converts an object to a public key | |
fn to_public_key(&self) -> Result<bitcoin::PublicKey, Error>; | |
/// Computes the size of a public key when serialized in a script, | |
/// including the length bytes | |
fn serialized_len(&self) -> Result<usize, Error>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment