@@ -91,14 +91,22 @@ impl Readable for Route {
91
91
}
92
92
}
93
93
94
- #[ derive( PartialEq ) ]
95
- struct DirectionalChannelInfo {
94
+ /// Details of channel routing parameters for one-direction, as stored in ChannelInfo
95
+ #[ derive( Clone , PartialEq ) ]
96
+ pub struct DirectionalChannelInfo {
97
+ /// node_id
96
98
src_node_id : PublicKey ,
99
+ /// last update on channel state sent by node_id
97
100
last_update : u32 ,
101
+ /// channel readiness as assess by node_id
98
102
enabled : bool ,
103
+ /// CLTV delta added by node_id for an outgoing HTLC
99
104
cltv_expiry_delta : u16 ,
105
+ /// Minimum outgoing HLTC value
100
106
htlc_minimum_msat : u64 ,
107
+ /// Minimum fee payed on outgoing HTLC
101
108
fee_base_msat : u32 ,
109
+ /// Proportional fee payed on outgoing HTLC
102
110
fee_proportional_millionths : u32 ,
103
111
last_update_message : Option < msgs:: ChannelUpdate > ,
104
112
}
@@ -121,12 +129,17 @@ impl_writeable!(DirectionalChannelInfo, 0, {
121
129
last_update_message
122
130
} ) ;
123
131
124
- #[ derive( PartialEq ) ]
125
- struct ChannelInfo {
126
- short_channel_id : u64 ,
127
- features : ChannelFeatures ,
128
- one_to_two : DirectionalChannelInfo ,
129
- two_to_one : DirectionalChannelInfo ,
132
+ /// Details of a channel, as stored in NetworkMap and returned by Router::list_edges
133
+ #[ derive( Clone , PartialEq ) ]
134
+ pub struct ChannelInfo {
135
+ /// The short_channel_id of this channel
136
+ pub short_channel_id : u64 ,
137
+ /// The channel features
138
+ pub features : ChannelFeatures ,
139
+ /// Alice to Bob channel routing parameters
140
+ pub one_to_two : DirectionalChannelInfo ,
141
+ /// Bob to Alice channel routing parameters
142
+ pub two_to_one : DirectionalChannelInfo ,
130
143
//this is cached here so we can send out it later if required by route_init_sync
131
144
//keep an eye on this to see if the extra memory is a problem
132
145
announcement_message : Option < msgs:: ChannelAnnouncement > ,
@@ -1060,6 +1073,17 @@ impl Router {
1060
1073
1061
1074
Err ( LightningError { err : "Failed to find a path to the given destination" , action : ErrorAction :: IgnoreError } )
1062
1075
}
1076
+
1077
+ /// Gets the list of announced channels, in random order. See ChannelInfo details field documentation for more information
1078
+ pub fn list_edges ( & self ) -> Vec < ChannelInfo > {
1079
+ let mut edges = Vec :: new ( ) ;
1080
+ let network = self . network_map . read ( ) . unwrap ( ) ;
1081
+ edges. reserve ( network. channels . len ( ) ) ;
1082
+ for ( _, chan) in network. channels . iter ( ) {
1083
+ edges. push ( ( * chan) . clone ( ) ) ;
1084
+ }
1085
+ edges
1086
+ }
1063
1087
}
1064
1088
1065
1089
#[ cfg( test) ]
0 commit comments