Skip to content

Commit 4980604

Browse files
committed
Delete the pretaproot module
In preparation for removing the `DescriptorTrait` remove the pretaproot module. This is possible because removing the trait will resolve the error return issues that the taproot module exists to solve.
1 parent 03d4bd6 commit 4980604

File tree

3 files changed

+0
-324
lines changed

3 files changed

+0
-324
lines changed

src/descriptor/mod.rs

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ use crate::{
4040
ToPublicKey, TranslatePk, TranslatePk2,
4141
};
4242

43-
// Directly export from lib.rs, exporting the trait here causes conflicts in this file
44-
pub(crate) mod pretaproot;
45-
4643
mod bare;
4744
mod segwitv0;
4845
mod sh;
@@ -398,43 +395,6 @@ impl<Pk: MiniscriptKey> Descriptor<Pk> {
398395
Descriptor::Tr(ref _tr) => DescriptorType::Tr,
399396
}
400397
}
401-
402-
/// .
403-
/// Convert a Descriptor into [`pretaproot::PreTaprootDescriptor`]
404-
/// # Examples
405-
///
406-
/// ```
407-
/// use std::str::FromStr;
408-
/// use miniscript::descriptor::Descriptor;
409-
/// use miniscript::{PreTaprootDescriptor, PreTaprootDescriptorTrait};
410-
/// use miniscript::bitcoin;
411-
///
412-
/// // A descriptor with a string generic
413-
/// let desc = Descriptor::<bitcoin::PublicKey>::from_str("wpkh(02e18f242c8b0b589bfffeac30e1baa80a60933a649c7fb0f1103e78fbf58aa0ed)")
414-
/// .expect("Valid segwitv0 descriptor");
415-
/// let pre_tap_desc = desc.into_pre_taproot_desc().expect("Wsh is pre taproot");
416-
///
417-
/// // Now the script code and explicit script no longer fail on longer fail
418-
/// // on PreTaprootDescriptor using PreTaprootDescriptorTrait
419-
/// let script_code = pre_tap_desc.script_code();
420-
/// assert_eq!(script_code.to_string(),
421-
/// "Script(OP_DUP OP_HASH160 OP_PUSHBYTES_20 62107d047e8818b594303fe0657388cc4fc8771f OP_EQUALVERIFY OP_CHECKSIG)"
422-
/// );
423-
/// ```
424-
///
425-
/// # Errors
426-
///
427-
/// This function will return an error if descriptor is not a pre taproot descriptor.
428-
pub fn into_pre_taproot_desc(self) -> Result<pretaproot::PreTaprootDescriptor<Pk>, Self> {
429-
match self {
430-
Descriptor::Bare(bare) => Ok(pretaproot::PreTaprootDescriptor::Bare(bare)),
431-
Descriptor::Pkh(pkh) => Ok(pretaproot::PreTaprootDescriptor::Pkh(pkh)),
432-
Descriptor::Wpkh(wpkh) => Ok(pretaproot::PreTaprootDescriptor::Wpkh(wpkh)),
433-
Descriptor::Sh(sh) => Ok(pretaproot::PreTaprootDescriptor::Sh(sh)),
434-
Descriptor::Wsh(wsh) => Ok(pretaproot::PreTaprootDescriptor::Wsh(wsh)),
435-
Descriptor::Tr(tr) => Err(Descriptor::Tr(tr)),
436-
}
437-
}
438398
}
439399

440400
impl<P, Q> TranslatePk<P, Q> for Descriptor<P>

src/descriptor/pretaproot.rs

Lines changed: 0 additions & 282 deletions
This file was deleted.

src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ use std::{error, fmt, hash, str};
114114
use bitcoin::blockdata::{opcodes, script};
115115
use bitcoin::hashes::{hash160, sha256, Hash};
116116

117-
pub use crate::descriptor::pretaproot::traits::PreTaprootDescriptorTrait;
118-
pub use crate::descriptor::pretaproot::PreTaprootDescriptor;
119117
pub use crate::descriptor::{Descriptor, DescriptorPublicKey, DescriptorTrait};
120118
pub use crate::interpreter::Interpreter;
121119
pub use crate::miniscript::context::{BareCtx, Legacy, ScriptContext, Segwitv0, Tap};

0 commit comments

Comments
 (0)