@@ -17,7 +17,7 @@ use bitcoin::secp256k1::PublicKey;
1717use crate :: ln:: channelmanager:: ChannelDetails ;
1818use crate :: ln:: features:: { ChannelFeatures , InvoiceFeatures , NodeFeatures } ;
1919use crate :: ln:: msgs:: { DecodeError , ErrorAction , LightningError , MAX_VALUE_MSAT } ;
20- use crate :: routing:: gossip:: { DirectedChannelInfoWithUpdate , EffectiveCapacity , ReadOnlyNetworkGraph , NetworkGraph , NodeId , RoutingFees } ;
20+ use crate :: routing:: gossip:: { DirectedChannelInfo , EffectiveCapacity , ReadOnlyNetworkGraph , NetworkGraph , NodeId , RoutingFees } ;
2121use crate :: routing:: scoring:: { ChannelUsage , Score } ;
2222use crate :: util:: ser:: { Writeable , Readable , Writer } ;
2323use crate :: util:: logger:: { Level , Logger } ;
@@ -421,7 +421,7 @@ enum CandidateRouteHop<'a> {
421421 } ,
422422 /// A hop found in the [`ReadOnlyNetworkGraph`], where the channel capacity may be unknown.
423423 PublicHop {
424- info : DirectedChannelInfoWithUpdate < ' a > ,
424+ info : DirectedChannelInfo < ' a > ,
425425 short_channel_id : u64 ,
426426 } ,
427427 /// A hop to the payee found in the payment invoice, though not necessarily a direct channel.
@@ -1276,13 +1276,11 @@ where L::Target: Logger {
12761276 for chan_id in $node. channels. iter( ) {
12771277 let chan = network_channels. get( chan_id) . unwrap( ) ;
12781278 if !chan. features. requires_unknown_bits( ) {
1279- let ( directed_channel, source) =
1280- chan. as_directed_to( & $node_id) . expect( "inconsistent NetworkGraph" ) ;
1281- if first_hops. is_none( ) || * source != our_node_id {
1282- if let Some ( direction) = directed_channel. direction( ) {
1283- if direction. enabled {
1279+ if let Some ( ( directed_channel, source) ) = chan. as_directed_to( & $node_id) {
1280+ if first_hops. is_none( ) || * source != our_node_id {
1281+ if directed_channel. direction( ) . enabled {
12841282 let candidate = CandidateRouteHop :: PublicHop {
1285- info: directed_channel. with_update ( ) . unwrap ( ) ,
1283+ info: directed_channel,
12861284 short_channel_id: * chan_id,
12871285 } ;
12881286 add_entry!( candidate, * source, $node_id,
@@ -1367,8 +1365,7 @@ where L::Target: Logger {
13671365 let candidate = network_channels
13681366 . get ( & hop. short_channel_id )
13691367 . and_then ( |channel| channel. as_directed_to ( & target) )
1370- . and_then ( |( channel, _) | channel. with_update ( ) )
1371- . map ( |info| CandidateRouteHop :: PublicHop {
1368+ . map ( |( info, _) | CandidateRouteHop :: PublicHop {
13721369 info,
13731370 short_channel_id : hop. short_channel_id ,
13741371 } )
@@ -1816,10 +1813,8 @@ fn add_random_cltv_offset(route: &mut Route, payment_params: &PaymentParameters,
18161813 random_channel. as_directed_from ( & cur_node_id) . map ( |( dir_info, next_id) | {
18171814 if !nodes_to_avoid. iter ( ) . any ( |x| x == next_id) {
18181815 nodes_to_avoid[ random_hop] = * next_id;
1819- dir_info. direction ( ) . map ( |channel_update_info| {
1820- random_hop_offset = channel_update_info. cltv_expiry_delta . into ( ) ;
1821- cur_hop = Some ( * next_id) ;
1822- } ) ;
1816+ random_hop_offset = dir_info. direction ( ) . cltv_expiry_delta . into ( ) ;
1817+ cur_hop = Some ( * next_id) ;
18231818 }
18241819 } ) ;
18251820 }
@@ -5214,14 +5209,12 @@ mod tests {
52145209 for channel_id in & cur_node. channels {
52155210 if let Some ( channel_info) = network_channels. get ( & channel_id) {
52165211 if let Some ( ( dir_info, next_id) ) = channel_info. as_directed_from ( & cur_node_id) {
5217- if let Some ( channel_update_info) = dir_info. direction ( ) {
5218- let next_cltv_expiry_delta = channel_update_info. cltv_expiry_delta as u32 ;
5219- if cur_path_cltv_deltas. iter ( ) . sum :: < u32 > ( )
5220- . saturating_add ( next_cltv_expiry_delta) <= observed_cltv_expiry_delta {
5221- let mut new_path_cltv_deltas = cur_path_cltv_deltas. clone ( ) ;
5222- new_path_cltv_deltas. push ( next_cltv_expiry_delta) ;
5223- candidates. push_back ( ( * next_id, new_path_cltv_deltas) ) ;
5224- }
5212+ let next_cltv_expiry_delta = dir_info. direction ( ) . cltv_expiry_delta as u32 ;
5213+ if cur_path_cltv_deltas. iter ( ) . sum :: < u32 > ( )
5214+ . saturating_add ( next_cltv_expiry_delta) <= observed_cltv_expiry_delta {
5215+ let mut new_path_cltv_deltas = cur_path_cltv_deltas. clone ( ) ;
5216+ new_path_cltv_deltas. push ( next_cltv_expiry_delta) ;
5217+ candidates. push_back ( ( * next_id, new_path_cltv_deltas) ) ;
52255218 }
52265219 }
52275220 }
0 commit comments