]> Untitled Git - bdk-cli/commitdiff
chore: rename ScriptType enum to CompileScriptType
authorVihiga Tyonum <withtvpeter@gmail.com>
Wed, 28 Oct 2026 12:18:10 +0000 (13:18 +0100)
committerVihiga Tyonum <withtvpeter@gmail.com>
Wed, 28 Oct 2026 12:18:10 +0000 (13:18 +0100)
- Rename the enum to make it clear to understand and
distinguish from other Script type enums.

src/handlers/descriptor.rs
src/utils/descriptors.rs

index d6e69ae989289eeed18fe5cbd7d0d929eea1bbb6..598617aecb3ec6c742b8b017a83ab7886fa0b509 100644 (file)
@@ -14,7 +14,7 @@ use crate::{
 use clap::Parser;
 #[cfg(feature = "compiler")]
 use {
-    crate::utils::descriptors::{ScriptType, compile_policy},
+    crate::utils::descriptors::{CompileScriptType, compile_policy},
     bdk_wallet::miniscript::descriptor::DescriptorPublicKey,
 };
 
@@ -64,9 +64,9 @@ pub struct CompileCommand {
         short = 't',
         long = "type",
         value_enum,
-        default_value_t = ScriptType::Wsh
+        default_value_t = CompileScriptType::Wsh
     )]
-    script_type: ScriptType,
+    script_type: CompileScriptType,
     /// Skip key and hash validation, accepting placeholders (e.g. pk(A)). Useful for
     /// inspecting a policy's shape without real keys. Descriptors compiled with this
     /// flag are not usable for spending.
index c14b1205fc08e318ba964132c5b7a58f1c3c9ad3..15e8bca7b26e19a7ddebd64aab6e712e089aefa5 100644 (file)
@@ -263,7 +263,7 @@ const NUMS_UNSPENDABLE_KEY_HEX: &str =
 /// Script types the compiled policy can be embedded in.
 #[cfg(feature = "compiler")]
 #[derive(Clone, Copy, ValueEnum, Debug, Eq, PartialEq)]
-pub enum ScriptType {
+pub enum CompileScriptType {
     Sh,
     Wsh,
     ShWsh,
@@ -299,7 +299,7 @@ fn check_policy_keys<Pk: MiniscriptKey, Ctx: ScriptContext>(
 #[cfg(feature = "compiler")]
 pub fn compile_policy<Pk: FromStrKey>(
     policy_str: &str,
-    script_type: ScriptType,
+    script_type: CompileScriptType,
 ) -> Result<(String, Option<String>), Error> {
     let policy: Concrete<Pk> = Concrete::from_str(policy_str)
         .map_err(|e| Error::Generic(format!("Invalid policy: {e}")))?;
@@ -309,19 +309,19 @@ pub fn compile_policy<Pk: FromStrKey>(
     // Compile per branch, not once up front: the contexts have different script
     // limits, and the narrowest one would reject policies valid for the requested type.
     let descriptor = match script_type {
-        ScriptType::Sh => {
+        CompileScriptType::Sh => {
             check_policy_keys::<Pk, Legacy>(&policy)?;
             Descriptor::new_sh(policy.compile()?)
         }
-        ScriptType::Wsh => {
+        CompileScriptType::Wsh => {
             check_policy_keys::<Pk, Segwitv0>(&policy)?;
             Descriptor::new_wsh(policy.compile()?)
         }
-        ScriptType::ShWsh => {
+        CompileScriptType::ShWsh => {
             check_policy_keys::<Pk, Segwitv0>(&policy)?;
             Descriptor::new_sh_wsh(policy.compile()?)
         }
-        ScriptType::Tr => {
+        CompileScriptType::Tr => {
             check_policy_keys::<Pk, Tap>(&policy)?;
             // Use a randomized unspendable internal key (H + rG) instead of a fixed NUMS
             // point. This improves privacy by preventing observers from determining whether