File tree Expand file tree Collapse file tree 3 files changed +19
-11
lines changed
Expand file tree Collapse file tree 3 files changed +19
-11
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use crate::payment_store::{
88} ;
99
1010use crate :: io:: { KVStore , EVENT_QUEUE_PERSISTENCE_KEY , EVENT_QUEUE_PERSISTENCE_NAMESPACE } ;
11- use crate :: logger:: { log_error, log_info, Logger } ;
11+ use crate :: logger:: { log_debug , log_error, log_info, Logger } ;
1212
1313use lightning:: chain:: chaininterface:: { BroadcasterInterface , ConfirmationTarget , FeeEstimator } ;
1414use lightning:: events:: Event as LdkEvent ;
@@ -564,7 +564,10 @@ where
564564 & Secp256k1 :: new ( ) ,
565565 ) ;
566566 match res {
567- Ok ( spending_tx) => self . wallet . broadcast_transaction ( & spending_tx) ,
567+ Ok ( Some ( spending_tx) ) => self . wallet . broadcast_transaction ( & spending_tx) ,
568+ Ok ( None ) => {
569+ log_debug ! ( self . logger, "Omitted spending static outputs: {:?}" , outputs) ;
570+ }
568571 Err ( err) => {
569572 log_error ! ( self . logger, "Error spending outputs: {:?}" , err) ;
570573 }
Original file line number Diff line number Diff line change 11pub ( crate ) use lightning:: util:: logger:: Logger ;
2- pub ( crate ) use lightning:: { log_error, log_info, log_trace} ;
2+ pub ( crate ) use lightning:: { log_debug , log_error, log_info, log_trace} ;
33
44use lightning:: util:: logger:: { Level , Record } ;
55use lightning:: util:: ser:: Writer ;
Original file line number Diff line number Diff line change @@ -362,19 +362,24 @@ where
362362 & self , descriptors : & [ & SpendableOutputDescriptor ] , outputs : Vec < TxOut > ,
363363 change_destination_script : Script , feerate_sat_per_1000_weight : u32 ,
364364 secp_ctx : & Secp256k1 < C > ,
365- ) -> Result < Transaction , ( ) > {
365+ ) -> Result < Option < Transaction > , ( ) > {
366366 let only_non_static = & descriptors
367367 . iter ( )
368368 . filter ( |desc| !matches ! ( desc, SpendableOutputDescriptor :: StaticOutput { .. } ) )
369369 . copied ( )
370370 . collect :: < Vec < _ > > ( ) ;
371- self . inner . spend_spendable_outputs (
372- only_non_static,
373- outputs,
374- change_destination_script,
375- feerate_sat_per_1000_weight,
376- secp_ctx,
377- )
371+ if only_non_static. is_empty ( ) {
372+ return Ok ( None ) ;
373+ }
374+ self . inner
375+ . spend_spendable_outputs (
376+ only_non_static,
377+ outputs,
378+ change_destination_script,
379+ feerate_sat_per_1000_weight,
380+ secp_ctx,
381+ )
382+ . map ( Some )
378383 }
379384
380385 pub fn sign_message ( & self , msg : & [ u8 ] ) -> Result < String , Error > {
You can’t perform that action at this time.
0 commit comments