51ffd91b50483d58bc2016440bdb98d9f82886e5
[rust-lightning] / lightning / src / routing / mod.rs
1 // This file is Copyright its original authors, visible in version control
2 // history.
3 //
4 // This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
5 // or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
7 // You may not use this file except in accordance with one or both of these
8 // licenses.
9
10 //! Structs and impls for receiving messages about the network and storing the topology live here.
11
12 pub mod network_graph;
13 pub mod router;
14 pub mod scorer;
15
16 use routing::network_graph::NodeId;
17
18 /// An interface used to score payment channels for path finding.
19 ///
20 ///     Scoring is in terms of fees willing to be paid in order to avoid routing through a channel.
21 pub trait Score {
22         /// Returns the fee in msats willing to be paid to avoid routing through the given channel
23         /// in the direction from `source` to `target`.
24         fn channel_penalty_msat(&self, short_channel_id: u64, source: &NodeId, target: &NodeId) -> u64;
25 }