@@ -423,7 +423,7 @@ impl<'a> CandidateRouteHop<'a> {
423423/// so that we can choose cheaper paths (as per Dijkstra's algorithm).
424424/// Fee values should be updated only in the context of the whole path, see update_value_and_recompute_fees.
425425/// These fee values are useful to choose hops as we traverse the graph "payee-to-payer".
426- #[ derive( Clone , Debug ) ]
426+ #[ derive( Clone ) ]
427427struct PathBuildingHop < ' a > {
428428 // Note that this should be dropped in favor of loading it from CandidateRouteHop, but doing so
429429 // is a larger refactor and will require careful performance analysis.
@@ -463,6 +463,22 @@ struct PathBuildingHop<'a> {
463463 value_contribution_msat : u64 ,
464464}
465465
466+ impl < ' a > core:: fmt:: Debug for PathBuildingHop < ' a > {
467+ fn fmt ( & self , f : & mut core:: fmt:: Formatter ) -> Result < ( ) , core:: fmt:: Error > {
468+ f. debug_struct ( "PathBuildingHop" )
469+ . field ( "node_id" , & self . node_id )
470+ . field ( "short_channel_id" , & self . candidate . short_channel_id ( ) )
471+ . field ( "total_fee_msat" , & self . total_fee_msat )
472+ . field ( "next_hops_fee_msat" , & self . next_hops_fee_msat )
473+ . field ( "hop_use_fee_msat" , & self . hop_use_fee_msat )
474+ . field ( "total_fee_msat - (next_hops_fee_msat + hop_use_fee_msat)" , & ( & self . total_fee_msat - ( & self . next_hops_fee_msat + & self . hop_use_fee_msat ) ) )
475+ . field ( "path_penalty_msat" , & self . path_penalty_msat )
476+ . field ( "path_htlc_minimum_msat" , & self . path_htlc_minimum_msat )
477+ . field ( "cltv_expiry_delta" , & self . candidate . cltv_expiry_delta ( ) )
478+ . finish ( )
479+ }
480+ }
481+
466482// Instantiated with a list of hops with correct data in them collected during path finding,
467483// an instance of this struct should be further modified only via given methods.
468484#[ derive( Clone ) ]
@@ -1300,8 +1316,8 @@ where L::Target: Logger {
13001316 ordered_hops. last_mut ( ) . unwrap ( ) . 0 . fee_msat = value_contribution_msat;
13011317 ordered_hops. last_mut ( ) . unwrap ( ) . 0 . hop_use_fee_msat = 0 ;
13021318
1303- log_trace ! ( logger, "Found a path back to us from the target with {} hops contributing up to {} msat: {: ?}" ,
1304- ordered_hops. len( ) , value_contribution_msat, ordered_hops) ;
1319+ log_trace ! ( logger, "Found a path back to us from the target with {} hops contributing up to {} msat: \n {:# ?}" ,
1320+ ordered_hops. len( ) , value_contribution_msat, ordered_hops. iter ( ) . map ( |h| & ( h . 0 ) ) . collect :: < Vec < & PathBuildingHop >> ( ) ) ;
13051321
13061322 let mut payment_path = PaymentPath { hops : ordered_hops} ;
13071323
0 commit comments