From: Valentine Wallace Date: Thu, 9 Feb 2023 20:36:35 +0000 (-0600) Subject: Remove unnecessary scoring methods from Router trait X-Git-Tag: v0.0.114-beta~19^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=2b2965f1fe6b0d7a2e7ca6ced88404ed7c723b3c;p=rust-lightning Remove unnecessary scoring methods from Router trait --- diff --git a/fuzz/src/chanmon_consistency.rs b/fuzz/src/chanmon_consistency.rs index 0caee0801..a088f64f4 100644 --- a/fuzz/src/chanmon_consistency.rs +++ b/fuzz/src/chanmon_consistency.rs @@ -97,10 +97,6 @@ impl Router for FuzzRouter { action: msgs::ErrorAction::IgnoreError }) } - fn notify_payment_path_failed(&self, _path: &[&RouteHop], _short_channel_id: u64) {} - fn notify_payment_path_successful(&self, _path: &[&RouteHop]) {} - fn notify_payment_probe_successful(&self, _path: &[&RouteHop]) {} - fn notify_payment_probe_failed(&self, _path: &[&RouteHop], _short_channel_id: u64) {} } pub struct TestBroadcaster {} diff --git a/fuzz/src/full_stack.rs b/fuzz/src/full_stack.rs index 57c665a2e..9b3b76c2b 100644 --- a/fuzz/src/full_stack.rs +++ b/fuzz/src/full_stack.rs @@ -140,10 +140,6 @@ impl Router for FuzzRouter { action: msgs::ErrorAction::IgnoreError }) } - fn notify_payment_path_failed(&self, _path: &[&RouteHop], _short_channel_id: u64) {} - fn notify_payment_path_successful(&self, _path: &[&RouteHop]) {} - fn notify_payment_probe_successful(&self, _path: &[&RouteHop]) {} - fn notify_payment_probe_failed(&self, _path: &[&RouteHop], _short_channel_id: u64) {} } struct TestBroadcaster { diff --git a/lightning/src/routing/router.rs b/lightning/src/routing/router.rs index 79838e185..cfee77a67 100644 --- a/lightning/src/routing/router.rs +++ b/lightning/src/routing/router.rs @@ -72,22 +72,6 @@ impl>, L: Deref, S: Deref> Router for DefaultR &random_seed_bytes ) } - - fn notify_payment_path_failed(&self, path: &[&RouteHop], short_channel_id: u64) { - self.scorer.lock().payment_path_failed(path, short_channel_id); - } - - fn notify_payment_path_successful(&self, path: &[&RouteHop]) { - self.scorer.lock().payment_path_successful(path); - } - - fn notify_payment_probe_successful(&self, path: &[&RouteHop]) { - self.scorer.lock().probe_successful(path); - } - - fn notify_payment_probe_failed(&self, path: &[&RouteHop], short_channel_id: u64) { - self.scorer.lock().probe_failed(path, short_channel_id); - } } /// A trait defining behavior for routing a payment. @@ -106,14 +90,6 @@ pub trait Router { ) -> Result { self.find_route(payer, route_params, first_hops, inflight_htlcs) } - /// Lets the router know that payment through a specific path has failed. - fn notify_payment_path_failed(&self, path: &[&RouteHop], short_channel_id: u64); - /// Lets the router know that payment through a specific path was successful. - fn notify_payment_path_successful(&self, path: &[&RouteHop]); - /// Lets the router know that a payment probe was successful. - fn notify_payment_probe_successful(&self, path: &[&RouteHop]); - /// Lets the router know that a payment probe failed. - fn notify_payment_probe_failed(&self, path: &[&RouteHop], short_channel_id: u64); } /// [`Score`] implementation that factors in in-flight HTLC liquidity. diff --git a/lightning/src/util/test_utils.rs b/lightning/src/util/test_utils.rs index 275221200..1c2cfe00d 100644 --- a/lightning/src/util/test_utils.rs +++ b/lightning/src/util/test_utils.rs @@ -135,10 +135,6 @@ impl<'a> Router for TestRouter<'a> { &[42; 32] ) } - fn notify_payment_path_failed(&self, _path: &[&RouteHop], _short_channel_id: u64) {} - fn notify_payment_path_successful(&self, _path: &[&RouteHop]) {} - fn notify_payment_probe_successful(&self, _path: &[&RouteHop]) {} - fn notify_payment_probe_failed(&self, _path: &[&RouteHop], _short_channel_id: u64) {} } #[cfg(feature = "std")] // If we put this on the `if`, we get "attributes are not yet allowed on `if` expressions" on 1.41.1