Skip to content

Commit dee3b31

Browse files
committed
[bindings] No-export RouteHopCandidate lifetime'd fields
The bindings cannot express lifetimes, so exposing any field which is a reference (and not `clone`-able, at least for garbage collected language bindings) is unsafe for those expecting a high-level interface. Thus, we simply no-export the `RouteHopCandidate` inner struct fields which are references (there are relevant accessors for them anyway).
1 parent c221193 commit dee3b31

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lightning/src/routing/router.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1146,8 +1146,12 @@ pub struct FirstHopCandidate<'a> {
11461146
/// has been funded and is able to pay), and accessor methods may panic otherwise.
11471147
///
11481148
/// [`find_route`] validates this prior to constructing a [`CandidateRouteHop`].
1149+
///
1150+
/// This is not exported to bindings users as lifetimes are not expressable in most languages.
11491151
pub details: &'a ChannelDetails,
11501152
/// The node id of the payer, which is also the source side of this candidate route hop.
1153+
///
1154+
/// This is not exported to bindings users as lifetimes are not expressable in most languages.
11511155
pub payer_node_id: &'a NodeId,
11521156
}
11531157

@@ -1156,6 +1160,8 @@ pub struct FirstHopCandidate<'a> {
11561160
pub struct PublicHopCandidate<'a> {
11571161
/// Information about the channel, including potentially its capacity and
11581162
/// direction-specific information.
1163+
///
1164+
/// This is not exported to bindings users as lifetimes are not expressable in most languages.
11591165
pub info: DirectedChannelInfo<'a>,
11601166
/// The short channel ID of the channel, i.e. the identifier by which we refer to this
11611167
/// channel.
@@ -1166,8 +1172,12 @@ pub struct PublicHopCandidate<'a> {
11661172
#[derive(Clone, Debug)]
11671173
pub struct PrivateHopCandidate<'a> {
11681174
/// Information about the private hop communicated via BOLT 11.
1175+
///
1176+
/// This is not exported to bindings users as lifetimes are not expressable in most languages.
11691177
pub hint: &'a RouteHintHop,
11701178
/// Node id of the next hop in BOLT 11 route hint.
1179+
///
1180+
/// This is not exported to bindings users as lifetimes are not expressable in most languages.
11711181
pub target_node_id: &'a NodeId
11721182
}
11731183

@@ -1176,6 +1186,8 @@ pub struct PrivateHopCandidate<'a> {
11761186
pub struct BlindedPathCandidate<'a> {
11771187
/// Information about the blinded path including the fee, HTLC amount limits, and
11781188
/// cryptographic material required to build an HTLC through the given path.
1189+
///
1190+
/// This is not exported to bindings users as lifetimes are not expressable in most languages.
11791191
pub hint: &'a (BlindedPayInfo, BlindedPath),
11801192
/// Index of the hint in the original list of blinded hints.
11811193
///
@@ -1191,6 +1203,8 @@ pub struct OneHopBlindedPathCandidate<'a> {
11911203
/// cryptographic material required to build an HTLC terminating with the given path.
11921204
///
11931205
/// Note that the [`BlindedPayInfo`] is ignored here.
1206+
///
1207+
/// This is not exported to bindings users as lifetimes are not expressable in most languages.
11941208
pub hint: &'a (BlindedPayInfo, BlindedPath),
11951209
/// Index of the hint in the original list of blinded hints.
11961210
///

0 commit comments

Comments
 (0)