//! # fn channel_penalty_msat(
//! # &self, _short_channel_id: u64, _source: &NodeId, _target: &NodeId
//! # ) -> u64 { 0 }
-//! # fn payment_path_failed(&mut self, _path: &Vec<RouteHop>, _short_channel_id: u64) {}
+//! # fn payment_path_failed(&mut self, _path: &[&RouteHop], _short_channel_id: u64) {}
//! # }
//! #
//! # struct FakeLogger {};
all_paths_failed, payment_id, payment_hash, rejected_by_dest, path, short_channel_id, retry, ..
} => {
if let Some(short_channel_id) = short_channel_id {
- self.scorer.lock().payment_path_failed(path, *short_channel_id);
+ let t = path.iter().collect::<Vec<_>>();
+ self.scorer.lock().payment_path_failed(&t, *short_channel_id);
}
if *rejected_by_dest {
&self, _short_channel_id: u64, _source: &NodeId, _target: &NodeId
) -> u64 { 0 }
- fn payment_path_failed(&mut self, _path: &Vec<RouteHop>, short_channel_id: u64) {
+ fn payment_path_failed(&mut self, _path: &[&RouteHop], short_channel_id: u64) {
if let Some(expected_short_channel_id) = self.expectations.pop_front() {
assert_eq!(short_channel_id, expected_short_channel_id);
}
fn channel_penalty_msat(&self, short_channel_id: u64, source: &NodeId, target: &NodeId) -> u64;
/// Handles updating channel penalties after failing to route through a channel.
- fn payment_path_failed(&mut self, path: &Vec<RouteHop>, short_channel_id: u64);
+ fn payment_path_failed(&mut self, path: &[&RouteHop], short_channel_id: u64);
}
/// A scorer that is accessed under a lock.
self.deref().channel_penalty_msat(short_channel_id, source, target)
}
- fn payment_path_failed(&mut self, path: &Vec<RouteHop>, short_channel_id: u64) {
+ fn payment_path_failed(&mut self, path: &[&RouteHop], short_channel_id: u64) {
self.deref_mut().payment_path_failed(path, short_channel_id)
}
}
if short_channel_id == self.short_channel_id { u64::max_value() } else { 0 }
}
- fn payment_path_failed(&mut self, _path: &Vec<RouteHop>, _short_channel_id: u64) {}
+ fn payment_path_failed(&mut self, _path: &[&RouteHop], _short_channel_id: u64) {}
}
struct BadNodeScorer {
if *target == self.node_id { u64::max_value() } else { 0 }
}
- fn payment_path_failed(&mut self, _path: &Vec<RouteHop>, _short_channel_id: u64) {}
+ fn payment_path_failed(&mut self, _path: &[&RouteHop], _short_channel_id: u64) {}
}
#[test]
self.params.base_penalty_msat + failure_penalty_msat
}
- fn payment_path_failed(&mut self, _path: &Vec<RouteHop>, short_channel_id: u64) {
+ fn payment_path_failed(&mut self, _path: &[&RouteHop], short_channel_id: u64) {
let failure_penalty_msat = self.params.failure_penalty_msat;
let half_life = self.params.failure_penalty_half_life;
self.channel_failures