@@ -173,17 +173,15 @@ pub struct DirectionalChannelInfo {
173
173
pub cltv_expiry_delta : u16 ,
174
174
/// The minimum value, which must be relayed to the next hop via the channel
175
175
pub htlc_minimum_msat : u64 ,
176
- /// Flat fee charged when the channel is used for routing
177
- pub fee_base_msat : u32 ,
178
- /// Fee based on used liquidity of the channel when it is used for routing
179
- pub fee_proportional_millionths : u32 ,
176
+ /// Fees charged when the channel is used for routing
177
+ pub fees : RoutingFees ,
180
178
/// Most recent update for the channel received from the network
181
179
pub last_update_message : Option < msgs:: ChannelUpdate > ,
182
180
}
183
181
184
182
impl std:: fmt:: Display for DirectionalChannelInfo {
185
183
fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> Result < ( ) , std:: fmt:: Error > {
186
- write ! ( f, "src_node_id {}, last_update {}, enabled {}, cltv_expiry_delta {}, htlc_minimum_msat {}, fee_base_msat {}, fee_proportional_millionths {} " , log_pubkey!( self . src_node_id) , self . last_update, self . enabled, self . cltv_expiry_delta, self . htlc_minimum_msat, self . fee_base_msat , self . fee_proportional_millionths ) ?;
184
+ write ! ( f, "src_node_id {}, last_update {}, enabled {}, cltv_expiry_delta {}, htlc_minimum_msat {}, fees {:?} " , log_pubkey!( self . src_node_id) , self . last_update, self . enabled, self . cltv_expiry_delta, self . htlc_minimum_msat, self . fees ) ?;
187
185
Ok ( ( ) )
188
186
}
189
187
}
@@ -194,8 +192,7 @@ impl_writeable!(DirectionalChannelInfo, 0, {
194
192
enabled,
195
193
cltv_expiry_delta,
196
194
htlc_minimum_msat,
197
- fee_base_msat,
198
- fee_proportional_millionths,
195
+ fees,
199
196
last_update_message
200
197
} ) ;
201
198
@@ -511,8 +508,10 @@ impl RoutingMessageHandler for NetworkGraph {
511
508
enabled : false ,
512
509
cltv_expiry_delta : u16:: max_value ( ) ,
513
510
htlc_minimum_msat : u64:: max_value ( ) ,
514
- fee_base_msat : u32:: max_value ( ) ,
515
- fee_proportional_millionths : u32:: max_value ( ) ,
511
+ fees : RoutingFees {
512
+ base_msat : u32:: max_value ( ) ,
513
+ proportional_millionths : u32:: max_value ( ) ,
514
+ } ,
516
515
last_update_message : None ,
517
516
} ,
518
517
two_to_one : DirectionalChannelInfo {
@@ -521,8 +520,10 @@ impl RoutingMessageHandler for NetworkGraph {
521
520
enabled : false ,
522
521
cltv_expiry_delta : u16:: max_value ( ) ,
523
522
htlc_minimum_msat : u64:: max_value ( ) ,
524
- fee_base_msat : u32:: max_value ( ) ,
525
- fee_proportional_millionths : u32:: max_value ( ) ,
523
+ fees : RoutingFees {
524
+ base_msat : u32:: max_value ( ) ,
525
+ proportional_millionths : u32:: max_value ( ) ,
526
+ } ,
526
527
last_update_message : None ,
527
528
} ,
528
529
announcement_message : if should_relay { Some ( msg. clone ( ) ) } else { None } ,
@@ -629,8 +630,8 @@ impl RoutingMessageHandler for NetworkGraph {
629
630
$target. enabled = chan_enabled;
630
631
$target. cltv_expiry_delta = msg. contents. cltv_expiry_delta;
631
632
$target. htlc_minimum_msat = msg. contents. htlc_minimum_msat;
632
- $target. fee_base_msat = msg. contents. fee_base_msat;
633
- $target. fee_proportional_millionths = msg. contents. fee_proportional_millionths;
633
+ $target. fees . base_msat = msg. contents. fee_base_msat;
634
+ $target. fees . proportional_millionths = msg. contents. fee_proportional_millionths;
634
635
$target. last_update_message = if msg. contents. excess_data. is_empty( ) {
635
636
Some ( msg. clone( ) )
636
637
} else {
@@ -673,11 +674,11 @@ impl RoutingMessageHandler for NetworkGraph {
673
674
for chan_id in node. channels . iter ( ) {
674
675
let chan = network. channels . get ( chan_id) . unwrap ( ) ;
675
676
if chan. one_to_two . src_node_id == dest_node_id {
676
- lowest_inbound_channel_fee_base_msat = cmp:: min ( lowest_inbound_channel_fee_base_msat, chan. two_to_one . fee_base_msat ) ;
677
- lowest_inbound_channel_fee_proportional_millionths = cmp:: min ( lowest_inbound_channel_fee_proportional_millionths, chan. two_to_one . fee_proportional_millionths ) ;
677
+ lowest_inbound_channel_fee_base_msat = cmp:: min ( lowest_inbound_channel_fee_base_msat, chan. two_to_one . fees . base_msat ) ;
678
+ lowest_inbound_channel_fee_proportional_millionths = cmp:: min ( lowest_inbound_channel_fee_proportional_millionths, chan. two_to_one . fees . proportional_millionths ) ;
678
679
} else {
679
- lowest_inbound_channel_fee_base_msat = cmp:: min ( lowest_inbound_channel_fee_base_msat, chan. one_to_two . fee_base_msat ) ;
680
- lowest_inbound_channel_fee_proportional_millionths = cmp:: min ( lowest_inbound_channel_fee_proportional_millionths, chan. one_to_two . fee_proportional_millionths ) ;
680
+ lowest_inbound_channel_fee_base_msat = cmp:: min ( lowest_inbound_channel_fee_base_msat, chan. one_to_two . fees . base_msat ) ;
681
+ lowest_inbound_channel_fee_proportional_millionths = cmp:: min ( lowest_inbound_channel_fee_proportional_millionths, chan. one_to_two . fees . proportional_millionths ) ;
681
682
}
682
683
}
683
684
}
@@ -1599,17 +1600,21 @@ mod tests {
1599
1600
enabled : false ,
1600
1601
cltv_expiry_delta : u16:: max_value ( ) ,
1601
1602
htlc_minimum_msat : 0 ,
1602
- fee_base_msat : u32:: max_value ( ) ,
1603
- fee_proportional_millionths : u32:: max_value ( ) ,
1603
+ fees : RoutingFees {
1604
+ base_msat : u32:: max_value ( ) ,
1605
+ proportional_millionths : u32:: max_value ( ) ,
1606
+ } ,
1604
1607
last_update_message : None ,
1605
1608
} , two_to_one : DirectionalChannelInfo {
1606
1609
src_node_id : node1. clone ( ) ,
1607
1610
last_update : 0 ,
1608
1611
enabled : true ,
1609
1612
cltv_expiry_delta : 0 ,
1610
1613
htlc_minimum_msat : 0 ,
1611
- fee_base_msat : 0 ,
1612
- fee_proportional_millionths : 0 ,
1614
+ fees : RoutingFees {
1615
+ base_msat : u32:: max_value ( ) ,
1616
+ proportional_millionths : u32:: max_value ( ) ,
1617
+ } ,
1613
1618
last_update_message : None ,
1614
1619
} ,
1615
1620
announcement_message : None ,
0 commit comments