11use crate :: {
2- hex_utils, ChannelId , ChannelManager , Config , Error , KeysManager , NetworkGraph , UserChannelId ,
3- Wallet ,
2+ hex_utils, ChannelManager , Config , Error , KeysManager , NetworkGraph , UserChannelId , Wallet ,
43} ;
54
65use crate :: payment_store:: {
@@ -17,7 +16,7 @@ use lightning::chain::chaininterface::{BroadcasterInterface, ConfirmationTarget,
1716use lightning:: events:: Event as LdkEvent ;
1817use lightning:: events:: PaymentPurpose ;
1918use lightning:: impl_writeable_tlv_based_enum;
20- use lightning:: ln:: PaymentHash ;
19+ use lightning:: ln:: { ChannelId , PaymentHash } ;
2120use lightning:: routing:: gossip:: NodeId ;
2221use lightning:: util:: errors:: APIError ;
2322use lightning:: util:: persist:: KVStore ;
@@ -573,7 +572,7 @@ where
573572 } ) ;
574573 }
575574 }
576- LdkEvent :: SpendableOutputs { outputs } => {
575+ LdkEvent :: SpendableOutputs { outputs, channel_id : _ } => {
577576 // TODO: We should eventually remember the outputs and supply them to the wallet's coin selection, once BDK allows us to do so.
578577 let destination_address = self . wallet . get_new_address ( ) . unwrap_or_else ( |e| {
579578 log_error ! ( self . logger, "Failed to get destination address: {}" , e) ;
@@ -664,7 +663,7 @@ where
664663 let nodes = read_only_network_graph. nodes ( ) ;
665664 let channels = self . channel_manager . list_channels ( ) ;
666665
667- let node_str = |channel_id : & Option < [ u8 ; 32 ] > | {
666+ let node_str = |channel_id : & Option < ChannelId > | {
668667 channel_id
669668 . and_then ( |channel_id| channels. iter ( ) . find ( |c| c. channel_id == channel_id) )
670669 . and_then ( |channel| {
@@ -678,11 +677,9 @@ where
678677 } )
679678 } )
680679 } ;
681- let channel_str = |channel_id : & Option < [ u8 ; 32 ] > | {
680+ let channel_str = |channel_id : & Option < ChannelId > | {
682681 channel_id
683- . map ( |channel_id| {
684- format ! ( " with channel {}" , hex_utils:: to_string( & channel_id) )
685- } )
682+ . map ( |channel_id| format ! ( " with channel {}" , channel_id) )
686683 . unwrap_or_default ( )
687684 } ;
688685 let from_prev_str = format ! (
@@ -725,16 +722,14 @@ where
725722 log_info ! (
726723 self . logger,
727724 "New channel {} with counterparty {} has been created and is pending confirmation on chain." ,
728- hex_utils :: to_string ( & channel_id) ,
725+ channel_id,
729726 counterparty_node_id,
730727 ) ;
731728 self . event_queue
732729 . add_event ( Event :: ChannelPending {
733- channel_id : ChannelId ( channel_id ) ,
730+ channel_id,
734731 user_channel_id : UserChannelId ( user_channel_id) ,
735- former_temporary_channel_id : ChannelId (
736- former_temporary_channel_id. unwrap ( ) ,
737- ) ,
732+ former_temporary_channel_id : former_temporary_channel_id. unwrap ( ) ,
738733 counterparty_node_id,
739734 funding_txo,
740735 } )
@@ -749,12 +744,12 @@ where
749744 log_info ! (
750745 self . logger,
751746 "Channel {} with counterparty {} ready to be used." ,
752- hex_utils :: to_string ( & channel_id) ,
747+ channel_id,
753748 counterparty_node_id,
754749 ) ;
755750 self . event_queue
756751 . add_event ( Event :: ChannelReady {
757- channel_id : ChannelId ( channel_id ) ,
752+ channel_id,
758753 user_channel_id : UserChannelId ( user_channel_id) ,
759754 counterparty_node_id : Some ( counterparty_node_id) ,
760755 } )
@@ -770,15 +765,10 @@ where
770765 counterparty_node_id,
771766 ..
772767 } => {
773- log_info ! (
774- self . logger,
775- "Channel {} closed due to: {:?}" ,
776- hex_utils:: to_string( & channel_id) ,
777- reason
778- ) ;
768+ log_info ! ( self . logger, "Channel {} closed due to: {:?}" , channel_id, reason) ;
779769 self . event_queue
780770 . add_event ( Event :: ChannelClosed {
781- channel_id : ChannelId ( channel_id ) ,
771+ channel_id,
782772 user_channel_id : UserChannelId ( user_channel_id) ,
783773 counterparty_node_id,
784774 } )
0 commit comments