Make DirectedChannelInfo `source` and `target` public
authorbenthecarman <benthecarman@live.com>
Fri, 2 Feb 2024 14:14:51 +0000 (14:14 +0000)
committerbenthecarman <benthecarman@live.com>
Fri, 2 Feb 2024 14:14:51 +0000 (14:14 +0000)
We use these params for our HubPreferentialScorer and without these
utility functions then we have to manually do this and calculate which
is the source and which is the target node.

lightning/src/routing/gossip.rs

index 9c8fd40af1358f1e1c8ae04646607da68a4e7abe..4c7a3762a278fa1e768af4034de4b5b98f014319 100644 (file)
@@ -1032,13 +1032,13 @@ impl<'a> DirectedChannelInfo<'a> {
        ///
        /// Refers to the `node_id` forwarding the payment to the next hop.
        #[inline]
-       pub(super) fn source(&self) -> &'a NodeId { if self.from_node_one { &self.channel.node_one } else { &self.channel.node_two } }
+       pub fn source(&self) -> &'a NodeId { if self.from_node_one { &self.channel.node_one } else { &self.channel.node_two } }
 
        /// Returns the `node_id` of the target hop.
        ///
        /// Refers to the `node_id` receiving the payment from the previous hop.
        #[inline]
-       pub(super) fn target(&self) -> &'a NodeId { if self.from_node_one { &self.channel.node_two } else { &self.channel.node_one } }
+       pub fn target(&self) -> &'a NodeId { if self.from_node_one { &self.channel.node_two } else { &self.channel.node_one } }
 }
 
 impl<'a> fmt::Debug for DirectedChannelInfo<'a> {