Merge pull request #1309 from TheBlueMatt/2022-02-first-hop-log
authorvalentinewallace <valentinewallace@users.noreply.github.com>
Tue, 22 Feb 2022 17:23:32 +0000 (12:23 -0500)
committerGitHub <noreply@github.com>
Tue, 22 Feb 2022 17:23:32 +0000 (12:23 -0500)
Specify whether we have first-hop hints when routing

1  2 
lightning/src/routing/router.rs

index 65119f0f843a5266f248ed53f1a9cdd05653a99e,2cd9c79a2fff62807ee9b5dc719d6c1b221aeef7..eab14c1e17f3119a748f58458aa1742aa3b6b1a7
@@@ -455,7 -455,7 +455,7 @@@ struct PathBuildingHop<'a> 
        /// decrease as well. Thus, we have to explicitly track which nodes have been processed and
        /// avoid processing them again.
        was_processed: bool,
 -      #[cfg(all(not(feature = "_bench_unstable"), any(test, feature = "fuzztarget")))]
 +      #[cfg(all(not(feature = "_bench_unstable"), any(test, fuzzing)))]
        // In tests, we apply further sanity checks on cases where we skip nodes we already processed
        // to ensure it is specifically in cases where the fee has gone down because of a decrease in
        // value_contribution_msat, which requires tracking it here. See comments below where it is
@@@ -719,8 -719,9 +719,9 @@@ where L::Target: Logger 
                        node_info.features.supports_basic_mpp()
                } else { false }
        } else { false };
-       log_trace!(logger, "Searching for a route from payer {} to payee {} {} MPP", our_node_pubkey,
-               payment_params.payee_pubkey, if allow_mpp { "with" } else { "without" });
+       log_trace!(logger, "Searching for a route from payer {} to payee {} {} MPP and {} first hops {}overriding the network graph", our_node_pubkey,
+               payment_params.payee_pubkey, if allow_mpp { "with" } else { "without" },
+               first_hops.map(|hops| hops.len()).unwrap_or(0), if first_hops.is_some() { "" } else { "not " });
  
        // Step (1).
        // Prepare the data we'll use for payee-to-payer search by
                                                                path_htlc_minimum_msat,
                                                                path_penalty_msat: u64::max_value(),
                                                                was_processed: false,
 -                                                              #[cfg(all(not(feature = "_bench_unstable"), any(test, feature = "fuzztarget")))]
 +                                                              #[cfg(all(not(feature = "_bench_unstable"), any(test, fuzzing)))]
                                                                value_contribution_msat,
                                                        }
                                                });
  
                                                #[allow(unused_mut)] // We only use the mut in cfg(test)
                                                let mut should_process = !old_entry.was_processed;
 -                                              #[cfg(all(not(feature = "_bench_unstable"), any(test, feature = "fuzztarget")))]
 +                                              #[cfg(all(not(feature = "_bench_unstable"), any(test, fuzzing)))]
                                                {
                                                        // In test/fuzzing builds, we do extra checks to make sure the skipping
                                                        // of already-seen nodes only happens in cases we expect (see below).
                                                                old_entry.fee_msat = 0; // This value will be later filled with hop_use_fee_msat of the following channel
                                                                old_entry.path_htlc_minimum_msat = path_htlc_minimum_msat;
                                                                old_entry.path_penalty_msat = path_penalty_msat;
 -                                                              #[cfg(all(not(feature = "_bench_unstable"), any(test, feature = "fuzztarget")))]
 +                                                              #[cfg(all(not(feature = "_bench_unstable"), any(test, fuzzing)))]
                                                                {
                                                                        old_entry.value_contribution_msat = value_contribution_msat;
                                                                }
                                                                did_add_update_path_to_src_node = true;
                                                        } else if old_entry.was_processed && new_cost < old_cost {
 -                                                              #[cfg(all(not(feature = "_bench_unstable"), any(test, feature = "fuzztarget")))]
 +                                                              #[cfg(all(not(feature = "_bench_unstable"), any(test, fuzzing)))]
                                                                {
                                                                        // If we're skipping processing a node which was previously
                                                                        // processed even though we found another path to it with a