@@ -17,7 +17,7 @@ use bitcoin::secp256k1::PublicKey;
17
17
use crate :: ln:: channelmanager:: ChannelDetails ;
18
18
use crate :: ln:: features:: { ChannelFeatures , InvoiceFeatures , NodeFeatures } ;
19
19
use 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 } ;
21
21
use crate :: routing:: scoring:: { ChannelUsage , Score } ;
22
22
use crate :: util:: ser:: { Writeable , Readable , Writer } ;
23
23
use crate :: util:: logger:: { Level , Logger } ;
@@ -421,7 +421,7 @@ enum CandidateRouteHop<'a> {
421
421
} ,
422
422
/// A hop found in the [`ReadOnlyNetworkGraph`], where the channel capacity may be unknown.
423
423
PublicHop {
424
- info : DirectedChannelInfoWithUpdate < ' a > ,
424
+ info : DirectedChannelInfo < ' a > ,
425
425
short_channel_id : u64 ,
426
426
} ,
427
427
/// A hop to the payee found in the payment invoice, though not necessarily a direct channel.
@@ -1276,13 +1276,11 @@ where L::Target: Logger {
1276
1276
for chan_id in $node. channels. iter( ) {
1277
1277
let chan = network_channels. get( chan_id) . unwrap( ) ;
1278
1278
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 {
1284
1282
let candidate = CandidateRouteHop :: PublicHop {
1285
- info: directed_channel. with_update ( ) . unwrap ( ) ,
1283
+ info: directed_channel,
1286
1284
short_channel_id: * chan_id,
1287
1285
} ;
1288
1286
add_entry!( candidate, * source, $node_id,
@@ -1367,8 +1365,7 @@ where L::Target: Logger {
1367
1365
let candidate = network_channels
1368
1366
. get ( & hop. short_channel_id )
1369
1367
. 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 {
1372
1369
info,
1373
1370
short_channel_id : hop. short_channel_id ,
1374
1371
} )
@@ -1816,10 +1813,8 @@ fn add_random_cltv_offset(route: &mut Route, payment_params: &PaymentParameters,
1816
1813
random_channel. as_directed_from ( & cur_node_id) . map ( |( dir_info, next_id) | {
1817
1814
if !nodes_to_avoid. iter ( ) . any ( |x| x == next_id) {
1818
1815
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) ;
1823
1818
}
1824
1819
} ) ;
1825
1820
}
@@ -5214,14 +5209,12 @@ mod tests {
5214
5209
for channel_id in & cur_node. channels {
5215
5210
if let Some ( channel_info) = network_channels. get ( & channel_id) {
5216
5211
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) ) ;
5225
5218
}
5226
5219
}
5227
5220
}
0 commit comments