@@ -112,8 +112,8 @@ pub(super) struct PendingHTLCInfo {
112
112
pub ( super ) routing : PendingHTLCRouting ,
113
113
pub ( super ) incoming_shared_secret : [ u8 ; 32 ] ,
114
114
payment_hash : PaymentHash ,
115
- pub ( super ) amt_to_forward : u64 ,
116
- pub ( super ) amt_incoming : Option < u64 > , // Added in 0.0.113
115
+ pub ( super ) incoming_amt_msat : Option < u64 > , // Added in 0.0.113
116
+ pub ( super ) outgoing_amt_msat : u64 ,
117
117
pub ( super ) outgoing_cltv_value : u32 ,
118
118
}
119
119
@@ -2197,8 +2197,8 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
2197
2197
routing,
2198
2198
payment_hash,
2199
2199
incoming_shared_secret : shared_secret,
2200
- amt_incoming : Some ( amt_msat) ,
2201
- amt_to_forward : amt_msat,
2200
+ incoming_amt_msat : Some ( amt_msat) ,
2201
+ outgoing_amt_msat : amt_msat,
2202
2202
outgoing_cltv_value : hop_data. outgoing_cltv_value ,
2203
2203
} )
2204
2204
}
@@ -2294,14 +2294,14 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
2294
2294
} ,
2295
2295
payment_hash : msg. payment_hash . clone ( ) ,
2296
2296
incoming_shared_secret : shared_secret,
2297
- amt_incoming : Some ( msg. amount_msat ) ,
2298
- amt_to_forward : next_hop_data. amt_to_forward ,
2297
+ incoming_amt_msat : Some ( msg. amount_msat ) ,
2298
+ outgoing_amt_msat : next_hop_data. amt_to_forward ,
2299
2299
outgoing_cltv_value : next_hop_data. outgoing_cltv_value ,
2300
2300
} )
2301
2301
}
2302
2302
} ;
2303
2303
2304
- if let & PendingHTLCStatus :: Forward ( PendingHTLCInfo { ref routing, ref amt_to_forward , ref outgoing_cltv_value, .. } ) = & pending_forward_info {
2304
+ if let & PendingHTLCStatus :: Forward ( PendingHTLCInfo { ref routing, ref outgoing_amt_msat , ref outgoing_cltv_value, .. } ) = & pending_forward_info {
2305
2305
// If short_channel_id is 0 here, we'll reject the HTLC as there cannot be a channel
2306
2306
// with a short_channel_id of 0. This is important as various things later assume
2307
2307
// short_channel_id is non-0 in any ::Forward.
@@ -2352,10 +2352,10 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
2352
2352
if !chan. is_live ( ) { // channel_disabled
2353
2353
break Some ( ( "Forwarding channel is not in a ready state." , 0x1000 | 20 , chan_update_opt) ) ;
2354
2354
}
2355
- if * amt_to_forward < chan. get_counterparty_htlc_minimum_msat ( ) { // amount_below_minimum
2355
+ if * outgoing_amt_msat < chan. get_counterparty_htlc_minimum_msat ( ) { // amount_below_minimum
2356
2356
break Some ( ( "HTLC amount was below the htlc_minimum_msat" , 0x1000 | 11 , chan_update_opt) ) ;
2357
2357
}
2358
- if let Err ( ( err, code) ) = chan. htlc_satisfies_config ( & msg, * amt_to_forward , * outgoing_cltv_value) {
2358
+ if let Err ( ( err, code) ) = chan. htlc_satisfies_config ( & msg, * outgoing_amt_msat , * outgoing_cltv_value) {
2359
2359
break Some ( ( err, code, chan_update_opt) ) ;
2360
2360
}
2361
2361
chan_update_opt
@@ -3157,8 +3157,8 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
3157
3157
HTLCForwardInfo :: AddHTLC ( PendingAddHTLCInfo {
3158
3158
prev_short_channel_id, prev_htlc_id, prev_funding_outpoint,
3159
3159
forward_info: PendingHTLCInfo {
3160
- routing, incoming_shared_secret, payment_hash, amt_to_forward ,
3161
- outgoing_cltv_value, amt_incoming : _
3160
+ routing, incoming_shared_secret, payment_hash, outgoing_amt_msat ,
3161
+ outgoing_cltv_value, incoming_amt_msat : _
3162
3162
}
3163
3163
} ) => {
3164
3164
macro_rules! failure_handler {
@@ -3220,7 +3220,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
3220
3220
} ;
3221
3221
match next_hop {
3222
3222
onion_utils:: Hop :: Receive ( hop_data) => {
3223
- match self . construct_recv_pending_htlc_info( hop_data, incoming_shared_secret, payment_hash, amt_to_forward , outgoing_cltv_value, Some ( phantom_shared_secret) ) {
3223
+ match self . construct_recv_pending_htlc_info( hop_data, incoming_shared_secret, payment_hash, outgoing_amt_msat , outgoing_cltv_value, Some ( phantom_shared_secret) ) {
3224
3224
Ok ( info) => phantom_receives. push( ( prev_short_channel_id, prev_funding_outpoint, vec![ ( info, prev_htlc_id) ] ) ) ,
3225
3225
Err ( ReceiveError { err_code, err_data, msg } ) => failed_payment!( msg, err_code, err_data, Some ( phantom_shared_secret) )
3226
3226
}
@@ -3264,8 +3264,8 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
3264
3264
HTLCForwardInfo :: AddHTLC ( PendingAddHTLCInfo {
3265
3265
prev_short_channel_id, prev_htlc_id, prev_funding_outpoint ,
3266
3266
forward_info : PendingHTLCInfo {
3267
- incoming_shared_secret, payment_hash, amt_to_forward , outgoing_cltv_value,
3268
- routing : PendingHTLCRouting :: Forward { onion_packet, .. } , amt_incoming : _,
3267
+ incoming_shared_secret, payment_hash, outgoing_amt_msat , outgoing_cltv_value,
3268
+ routing : PendingHTLCRouting :: Forward { onion_packet, .. } , incoming_amt_msat : _,
3269
3269
} ,
3270
3270
} ) => {
3271
3271
log_trace ! ( self . logger, "Adding HTLC from short id {} with payment_hash {} to channel with short id {} after delay" , prev_short_channel_id, log_bytes!( payment_hash. 0 ) , short_chan_id) ;
@@ -3277,7 +3277,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
3277
3277
// Phantom payments are only PendingHTLCRouting::Receive.
3278
3278
phantom_shared_secret : None ,
3279
3279
} ) ;
3280
- match chan. get_mut ( ) . send_htlc ( amt_to_forward , payment_hash, outgoing_cltv_value, htlc_source. clone ( ) , onion_packet, & self . logger ) {
3280
+ match chan. get_mut ( ) . send_htlc ( outgoing_amt_msat , payment_hash, outgoing_cltv_value, htlc_source. clone ( ) , onion_packet, & self . logger ) {
3281
3281
Err ( e) => {
3282
3282
if let ChannelError :: Ignore ( msg) = e {
3283
3283
log_trace ! ( self . logger, "Failed to forward HTLC with payment_hash {}: {}" , log_bytes!( payment_hash. 0 ) , msg) ;
@@ -3391,7 +3391,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
3391
3391
HTLCForwardInfo :: AddHTLC ( PendingAddHTLCInfo {
3392
3392
prev_short_channel_id, prev_htlc_id, prev_funding_outpoint,
3393
3393
forward_info : PendingHTLCInfo {
3394
- routing, incoming_shared_secret, payment_hash, amt_to_forward , ..
3394
+ routing, incoming_shared_secret, payment_hash, outgoing_amt_msat , ..
3395
3395
}
3396
3396
} ) => {
3397
3397
let ( cltv_expiry, onion_payload, payment_data, phantom_shared_secret) = match routing {
@@ -3413,9 +3413,9 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
3413
3413
incoming_packet_shared_secret : incoming_shared_secret,
3414
3414
phantom_shared_secret,
3415
3415
} ,
3416
- value : amt_to_forward ,
3416
+ value : outgoing_amt_msat ,
3417
3417
timer_ticks : 0 ,
3418
- total_msat : if let Some ( data) = & payment_data { data. total_msat } else { amt_to_forward } ,
3418
+ total_msat : if let Some ( data) = & payment_data { data. total_msat } else { outgoing_amt_msat } ,
3419
3419
cltv_expiry,
3420
3420
onion_payload,
3421
3421
} ;
@@ -3522,7 +3522,7 @@ impl<M: Deref, T: Deref, K: Deref, F: Deref, L: Deref> ChannelManager<M, T, K, F
3522
3522
e. insert ( ( purpose. clone ( ) , vec ! [ claimable_htlc] ) ) ;
3523
3523
new_events. push ( events:: Event :: PaymentReceived {
3524
3524
payment_hash,
3525
- amount_msat : amt_to_forward ,
3525
+ amount_msat : outgoing_amt_msat ,
3526
3526
purpose,
3527
3527
} ) ;
3528
3528
} ,
@@ -6472,9 +6472,9 @@ impl_writeable_tlv_based!(PendingHTLCInfo, {
6472
6472
( 0 , routing, required) ,
6473
6473
( 2 , incoming_shared_secret, required) ,
6474
6474
( 4 , payment_hash, required) ,
6475
- ( 6 , amt_to_forward , required) ,
6475
+ ( 6 , outgoing_amt_msat , required) ,
6476
6476
( 8 , outgoing_cltv_value, required) ,
6477
- ( 9 , amt_incoming , option) ,
6477
+ ( 9 , incoming_amt_msat , option) ,
6478
6478
} ) ;
6479
6479
6480
6480
0 commit comments