@@ -62,32 +62,29 @@ where
62
62
Self { outputs, wallet, keys_manager, kv_store, best_block, logger }
63
63
}
64
64
65
- pub ( crate ) fn add_outputs ( & self , output_descriptors : Vec < SpendableOutputDescriptor > ) {
65
+ pub ( crate ) fn add_outputs ( & self , mut output_descriptors : Vec < SpendableOutputDescriptor > ) {
66
+ let non_static_outputs = output_descriptors
67
+ . drain ( ..)
68
+ . filter ( |desc| !matches ! ( desc, SpendableOutputDescriptor :: StaticOutput { .. } ) )
69
+ . collect :: < Vec < _ > > ( ) ;
70
+
66
71
let mut locked_outputs = self . outputs . lock ( ) . unwrap ( ) ;
67
72
68
73
let cur_height = self . best_block . lock ( ) . unwrap ( ) . height ( ) ;
69
74
70
75
let ( spending_tx, broadcast_height) =
71
- match self . get_spending_tx ( & output_descriptors , cur_height) {
72
- Ok ( Some ( spending_tx) ) => {
76
+ match self . get_spending_tx ( & non_static_outputs , cur_height) {
77
+ Ok ( spending_tx) => {
73
78
self . wallet . broadcast_transactions ( & [ & spending_tx] ) ;
74
79
( Some ( spending_tx) , Some ( cur_height) )
75
80
}
76
- Ok ( None ) => {
77
- log_debug ! (
78
- self . logger,
79
- "Omitted spending static outputs: {:?}" ,
80
- output_descriptors
81
- ) ;
82
- ( None , None )
83
- }
84
81
Err ( e) => {
85
82
log_error ! ( self . logger, "Error spending outputs: {:?}" , e) ;
86
83
( None , None )
87
84
}
88
85
} ;
89
86
90
- for descriptor in output_descriptors {
87
+ for descriptor in non_static_outputs {
91
88
let id = self . keys_manager . get_secure_random_bytes ( ) ;
92
89
let output_info = SpendableOutputInfo {
93
90
id,
@@ -109,7 +106,7 @@ where
109
106
110
107
fn get_spending_tx (
111
108
& self , output_descriptors : & Vec < SpendableOutputDescriptor > , cur_height : u32 ,
112
- ) -> Result < Option < Transaction > , ( ) > {
109
+ ) -> Result < Transaction , ( ) > {
113
110
let tx_feerate =
114
111
self . wallet . get_est_sat_per_1000_weight ( ConfirmationTarget :: NonAnchorChannelFee ) ;
115
112
0 commit comments