Skip to content

Commit

Permalink
f - Rename destination to target
Browse files Browse the repository at this point in the history
  • Loading branch information
jkczyz committed Oct 19, 2021
1 parent a950b8f commit e3a1b8a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions lightning/src/routing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ use routing::network_graph::NodeId;
///
/// Scoring is in terms of fees willing to be paid in order to avoid routing through a channel.
pub trait Score {
/// Returns the fee in msats willing to be paid to avoid routing through the given channel from
/// `source` to `destination`.
fn channel_penalty_msat(
&self, short_channel_id: u64, source: &NodeId, destination: &NodeId
) -> u64;
/// Returns the fee in msats willing to be paid to avoid routing through the given channel
/// in the direction from `source` to `target`.
fn channel_penalty_msat(&self, short_channel_id: u64, source: &NodeId, target: &NodeId) -> u64;
}
6 changes: 3 additions & 3 deletions lightning/src/routing/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4385,7 +4385,7 @@ mod tests {
}

impl routing::Score for BadChannelScorer {
fn channel_penalty_msat(&self, short_channel_id: u64, _source: &NodeId, _destination: &NodeId) -> u64 {
fn channel_penalty_msat(&self, short_channel_id: u64, _source: &NodeId, _target: &NodeId) -> u64 {
if short_channel_id == self.short_channel_id { u64::max_value() } else { 0 }
}
}
Expand All @@ -4395,8 +4395,8 @@ mod tests {
}

impl routing::Score for BadNodeScorer {
fn channel_penalty_msat(&self, _short_channel_id: u64, _source: &NodeId, destination: &NodeId) -> u64 {
if *destination == self.node_id { u64::max_value() } else { 0 }
fn channel_penalty_msat(&self, _short_channel_id: u64, _source: &NodeId, target: &NodeId) -> u64 {
if *target == self.node_id { u64::max_value() } else { 0 }
}
}

Expand Down
2 changes: 1 addition & 1 deletion lightning/src/routing/scorer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl Default for Scorer {

impl routing::Score for Scorer {
fn channel_penalty_msat(
&self, _short_channel_id: u64, _source: &NodeId, _destination: &NodeId
&self, _short_channel_id: u64, _source: &NodeId, _target: &NodeId
) -> u64 {
self.base_penalty_msat
}
Expand Down

0 comments on commit e3a1b8a

Please sign in to comment.