File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
example-crates/example_cli/src Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 1
1
use crate :: miniscript:: { Descriptor , DescriptorPublicKey } ;
2
2
use bitcoin:: hashes:: { hash_newtype, sha256, Hash } ;
3
+ use bitcoin:: Amount ;
3
4
4
5
hash_newtype ! {
5
6
/// Represents the unique ID of a descriptor.
@@ -13,22 +14,21 @@ hash_newtype! {
13
14
14
15
/// A trait to extend the functionality of a miniscript descriptor.
15
16
pub trait DescriptorExt {
16
- /// Returns the minimum value (in satoshis) at which an output is broadcastable .
17
+ /// Returns the minimum [`Amount`] at which an output is broadcast-able .
17
18
/// Panics if the descriptor wildcard is hardened.
18
- fn dust_value ( & self ) -> u64 ;
19
+ fn dust_value ( & self ) -> Amount ;
19
20
20
21
/// Returns the descriptor ID, calculated as the sha256 hash of the spk derived from the
21
22
/// descriptor at index 0.
22
23
fn descriptor_id ( & self ) -> DescriptorId ;
23
24
}
24
25
25
26
impl DescriptorExt for Descriptor < DescriptorPublicKey > {
26
- fn dust_value ( & self ) -> u64 {
27
+ fn dust_value ( & self ) -> Amount {
27
28
self . at_derivation_index ( 0 )
28
29
. expect ( "descriptor can't have hardened derivation" )
29
30
. script_pubkey ( )
30
31
. minimal_non_dust ( )
31
- . to_sat ( )
32
32
}
33
33
34
34
fn descriptor_id ( & self ) -> DescriptorId {
Original file line number Diff line number Diff line change @@ -324,7 +324,7 @@ where
324
324
. expect ( "must exist" )
325
325
. 1 ;
326
326
327
- let min_drain_value = change_desc. dust_value ( ) ;
327
+ let min_drain_value = change_desc. dust_value ( ) . to_sat ( ) ;
328
328
329
329
let target = Target {
330
330
outputs : TargetOutputs :: fund_outputs (
You can’t perform that action at this time.
0 commit comments