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 ;
@@ -574,7 +573,7 @@ where
574573 } ) ;
575574 }
576575 }
577- LdkEvent :: SpendableOutputs { outputs } => {
576+ LdkEvent :: SpendableOutputs { outputs, channel_id : _ } => {
578577 // TODO: We should eventually remember the outputs and supply them to the wallet's coin selection, once BDK allows us to do so.
579578 let destination_address = self . wallet . get_new_address ( ) . unwrap_or_else ( |e| {
580579 log_error ! ( self . logger, "Failed to get destination address: {}" , e) ;
@@ -665,7 +664,7 @@ where
665664 let nodes = read_only_network_graph. nodes ( ) ;
666665 let channels = self . channel_manager . list_channels ( ) ;
667666
668- let node_str = |channel_id : & Option < [ u8 ; 32 ] > | {
667+ let node_str = |channel_id : & Option < ChannelId > | {
669668 channel_id
670669 . and_then ( |channel_id| channels. iter ( ) . find ( |c| c. channel_id == channel_id) )
671670 . and_then ( |channel| {
@@ -679,11 +678,9 @@ where
679678 } )
680679 } )
681680 } ;
682- let channel_str = |channel_id : & Option < [ u8 ; 32 ] > | {
681+ let channel_str = |channel_id : & Option < ChannelId > | {
683682 channel_id
684- . map ( |channel_id| {
685- format ! ( " with channel {}" , hex_utils:: to_string( & channel_id) )
686- } )
683+ . map ( |channel_id| format ! ( " with channel {}" , channel_id) )
687684 . unwrap_or_default ( )
688685 } ;
689686 let from_prev_str = format ! (
@@ -726,16 +723,14 @@ where
726723 log_info ! (
727724 self . logger,
728725 "New channel {} with counterparty {} has been created and is pending confirmation on chain." ,
729- hex_utils :: to_string ( & channel_id) ,
726+ channel_id,
730727 counterparty_node_id,
731728 ) ;
732729 self . event_queue
733730 . add_event ( Event :: ChannelPending {
734- channel_id : ChannelId ( channel_id ) ,
731+ channel_id,
735732 user_channel_id : UserChannelId ( user_channel_id) ,
736- former_temporary_channel_id : ChannelId (
737- former_temporary_channel_id. unwrap ( ) ,
738- ) ,
733+ former_temporary_channel_id : former_temporary_channel_id. unwrap ( ) ,
739734 counterparty_node_id,
740735 funding_txo,
741736 } )
@@ -750,12 +745,12 @@ where
750745 log_info ! (
751746 self . logger,
752747 "Channel {} with counterparty {} ready to be used." ,
753- hex_utils :: to_string ( & channel_id) ,
748+ channel_id,
754749 counterparty_node_id,
755750 ) ;
756751 self . event_queue
757752 . add_event ( Event :: ChannelReady {
758- channel_id : ChannelId ( channel_id ) ,
753+ channel_id,
759754 user_channel_id : UserChannelId ( user_channel_id) ,
760755 counterparty_node_id : Some ( counterparty_node_id) ,
761756 } )
@@ -771,15 +766,10 @@ where
771766 counterparty_node_id,
772767 ..
773768 } => {
774- log_info ! (
775- self . logger,
776- "Channel {} closed due to: {:?}" ,
777- hex_utils:: to_string( & channel_id) ,
778- reason
779- ) ;
769+ log_info ! ( self . logger, "Channel {} closed due to: {:?}" , channel_id, reason) ;
780770 self . event_queue
781771 . add_event ( Event :: ChannelClosed {
782- channel_id : ChannelId ( channel_id ) ,
772+ channel_id,
783773 user_channel_id : UserChannelId ( user_channel_id) ,
784774 counterparty_node_id,
785775 } )
0 commit comments