Skip to content

Add default impl for Miniscript::num_der_paths #578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/interpreter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ impl MiniscriptKey for BitcoinKey {
type Hash256 = hash256::Hash;
type Ripemd160 = ripemd160::Hash;
type Hash160 = hash160::Hash;

fn num_der_paths(&self) -> usize {
0
}
}

impl<'txin> Interpreter<'txin> {
Expand Down
20 changes: 3 additions & 17 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,9 @@ pub trait MiniscriptKey: Clone + Eq + Ord + fmt::Debug + fmt::Display + hash::Ha

/// Returns the number of different derivation paths in this key. Only >1 for keys
/// in BIP389 multipath descriptors.
fn num_der_paths(&self) -> usize;
fn num_der_paths(&self) -> usize {
0
}

/// The associated [`bitcoin::hashes::sha256::Hash`] for this [`MiniscriptKey`], used in the
/// sha256 fragment.
Expand All @@ -190,10 +192,6 @@ impl MiniscriptKey for bitcoin::secp256k1::PublicKey {
type Hash256 = hash256::Hash;
type Ripemd160 = ripemd160::Hash;
type Hash160 = hash160::Hash;

fn num_der_paths(&self) -> usize {
0
}
}

impl MiniscriptKey for bitcoin::PublicKey {
Expand All @@ -202,10 +200,6 @@ impl MiniscriptKey for bitcoin::PublicKey {
!self.compressed
}

fn num_der_paths(&self) -> usize {
0
}

type Sha256 = sha256::Hash;
type Hash256 = hash256::Hash;
type Ripemd160 = ripemd160::Hash;
Expand All @@ -221,21 +215,13 @@ impl MiniscriptKey for bitcoin::secp256k1::XOnlyPublicKey {
fn is_x_only_key(&self) -> bool {
true
}

fn num_der_paths(&self) -> usize {
0
}
}

impl MiniscriptKey for String {
type Sha256 = String; // specify hashes as string
type Hash256 = String;
type Ripemd160 = String;
type Hash160 = String;

fn num_der_paths(&self) -> usize {
0
}
}

/// Trait describing public key types which can be converted to bitcoin pubkeys
Expand Down