Merge rust-bitcoin/rust-bitcoin#1248: implement `From<PublicKey>` for `PubkeyHash`

81f81caa04 implement `From<PublicKey>` for `PubkeyHash` (Noah Lanson)

Pull request description:

  Part of #1245.

  Do we also want a method on `PubkeyHash` or is the `From` impl sufficient?

ACKs for top commit:
  tcharding:
    ACK 81f81caa04
  Kixunil:
    ACK 81f81caa04
  sanket1729:
    ACK 81f81caa04
  apoelstra:
    ACK 81f81caa04

Tree-SHA512: 760ea2991de60fd72d0aae18d375024f001f331d8a57b1e6e39b5933efa3a5af379effecb89cde0defb960b25c997b417fc126248589953655fb83db8b8dd608
This commit is contained in:
Andrew Poelstra 2022-09-09 21:02:22 +00:00
commit 4b662f8c57
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
1 changed files with 6 additions and 0 deletions

View File

@ -296,6 +296,12 @@ impl FromStr for PublicKey {
}
}
impl From<PublicKey> for PubkeyHash {
fn from(key: PublicKey) -> PubkeyHash {
key.pubkey_hash()
}
}
/// A Bitcoin ECDSA private key
#[derive(Copy, Clone, PartialEq, Eq)]
#[cfg_attr(feature = "std", derive(Debug))]