diff --git a/crates/chain/src/descriptor_ext.rs b/crates/chain/src/descriptor_ext.rs index eac01a684..9cf147582 100644 --- a/crates/chain/src/descriptor_ext.rs +++ b/crates/chain/src/descriptor_ext.rs @@ -1,5 +1,6 @@ use crate::miniscript::{Descriptor, DescriptorPublicKey}; use bitcoin::hashes::{hash_newtype, sha256, Hash}; +use bitcoin::Amount; hash_newtype! { /// Represents the unique ID of a descriptor. @@ -13,9 +14,9 @@ hash_newtype! { /// A trait to extend the functionality of a miniscript descriptor. pub trait DescriptorExt { - /// Returns the minimum value (in satoshis) at which an output is broadcastable. + /// Returns the minimum [`Amount`] at which an output is broadcast-able. /// Panics if the descriptor wildcard is hardened. - fn dust_value(&self) -> u64; + fn dust_value(&self) -> Amount; /// Returns the descriptor ID, calculated as the sha256 hash of the spk derived from the /// descriptor at index 0. @@ -23,12 +24,11 @@ pub trait DescriptorExt { } impl DescriptorExt for Descriptor { - fn dust_value(&self) -> u64 { + fn dust_value(&self) -> Amount { self.at_derivation_index(0) .expect("descriptor can't have hardened derivation") .script_pubkey() .minimal_non_dust() - .to_sat() } fn descriptor_id(&self) -> DescriptorId { diff --git a/example-crates/example_cli/src/lib.rs b/example-crates/example_cli/src/lib.rs index 8c17348b3..3a700db3a 100644 --- a/example-crates/example_cli/src/lib.rs +++ b/example-crates/example_cli/src/lib.rs @@ -324,7 +324,7 @@ where .expect("must exist") .1; - let min_drain_value = change_desc.dust_value(); + let min_drain_value = change_desc.dust_value().to_sat(); let target = Target { outputs: TargetOutputs::fund_outputs(