@@ -623,6 +623,40 @@ impl<G: Deref<Target = NetworkGraph>, L: Deref, T: Time> ProbabilisticScorerUsin
623623 assert ! ( self . channel_liquidities. insert( short_channel_id, liquidity) . is_none( ) ) ;
624624 self
625625 }
626+
627+ /// Dump the contents of this scorer into the configured logger.
628+ ///
629+ /// Note that this writes roughly one line per channel for which we have a liquidity estimate,
630+ /// which may be a substantial amount of log output.
631+ fn debug_log_liquidity_stats ( & self ) {
632+ let graph = self . network_graph . read_only ( ) ;
633+ for ( scid, liq) in self . channel_liquidities . iter ( ) {
634+ if let Some ( chan_debug) = graph. channels ( ) . get ( scid) {
635+ if let Some ( dir_debug) = & chan_debug. one_to_two {
636+ let amount = chan_debug. capacity_sats . map ( |v| v* 1000 ) . or ( dir_debug. htlc_maximum_msat ) ;
637+ if let Some ( amt) = amount {
638+ let dir_liq = liq. as_directed ( & chan_debug. node_one , & chan_debug. node_two , amt, self . liquidity_offset_half_life ) ;
639+ log_debug ! ( self . logger, "Liquidity from {:?} to {:?} via {} is in the range ({}, {})" ,
640+ chan_debug. node_one, chan_debug. node_two, scid, dir_liq. min_liquidity_msat( ) , dir_liq. max_liquidity_msat( ) ) ;
641+ } else {
642+ log_debug ! ( self . logger, "No amount known for SCID {} from {:?} to {:?}" , scid, chan_debug. node_one, chan_debug. node_two) ;
643+ }
644+ }
645+ if let Some ( dir_debug) = & chan_debug. two_to_one {
646+ let amount = chan_debug. capacity_sats . map ( |v| v* 1000 ) . or ( dir_debug. htlc_maximum_msat ) ;
647+ if let Some ( amt) = amount {
648+ let dir_liq = liq. as_directed ( & chan_debug. node_two , & chan_debug. node_one , amt, self . liquidity_offset_half_life ) ;
649+ log_debug ! ( self . logger, "Liquidity from {:?} to {:?} via {} is in the range ({}, {})" ,
650+ chan_debug. node_two, chan_debug. node_one, scid, dir_liq. min_liquidity_msat( ) , dir_liq. max_liquidity_msat( ) ) ;
651+ } else {
652+ log_debug ! ( self . logger, "No amount known for SCID {} from {:?} to {:?}" , scid, chan_debug. node_two, chan_debug. node_one) ;
653+ }
654+ }
655+ } else {
656+ log_debug ! ( self . logger, "No network graph entry for SCID {}" , scid) ;
657+ }
658+ }
659+ }
626660}
627661
628662impl ProbabilisticScoringParameters {
0 commit comments