Skip to content

Commit

Permalink
Merge pull request #40 from BP-WG/store
Browse files Browse the repository at this point in the history
Require Descriptors and DeriveKey to be Display+Clone
  • Loading branch information
dr-orlovsky authored Sep 5, 2024
2 parents 9da41a3 + efb5b67 commit 9387b53
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion derive/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

use std::cmp::Ordering;
use std::collections::BTreeSet;
use std::fmt::Display;
use std::num::ParseIntError;
use std::str::FromStr;

Expand Down Expand Up @@ -356,7 +357,7 @@ pub trait Derive<D> {
}
}

pub trait DeriveKey<D>: Derive<D> {
pub trait DeriveKey<D>: Derive<D> + Clone + Display {
fn xpub_spec(&self) -> &XpubAccount;
}

Expand Down
2 changes: 1 addition & 1 deletion descriptors/src/descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl TaprootKeySig {
pub fn new(key: XOnlyPk, sig: Bip340Sig) -> Self { TaprootKeySig { key, sig } }
}

pub trait Descriptor<K = XpubDerivable, V = ()>: DeriveScripts {
pub trait Descriptor<K = XpubDerivable, V = ()>: DeriveScripts + Clone + Display {
fn class(&self) -> SpkClass;
#[inline]
fn is_taproot(&self) -> bool { self.class().is_taproot() }
Expand Down
2 changes: 1 addition & 1 deletion descriptors/src/segwit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,6 @@ impl<K: DeriveCompr> Descriptor<K> for Wpkh<K> {
}
}

impl<K: DeriveCompr + Display> Display for Wpkh<K> {
impl<K: DeriveCompr> Display for Wpkh<K> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "wpkh({})", self.0) }
}
2 changes: 1 addition & 1 deletion descriptors/src/taproot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl<K: DeriveXOnly> Descriptor<K> for TrKey<K> {
}
}

impl<K: DeriveXOnly + Display> Display for TrKey<K> {
impl<K: DeriveXOnly> Display for TrKey<K> {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { write!(f, "tr({})", self.0) }
}

Expand Down

0 comments on commit 9387b53

Please sign in to comment.