Skip to content

Commit 6472eb6

Browse files
authored
Merge pull request #3971 from TheBlueMatt/2025-07-rename-again
Rename `Event::PaymentClaimable::via_channel_ids` to `receiving_..`
2 parents 55d8666 + 52613a7 commit 6472eb6

File tree

7 files changed

+47
-46
lines changed

7 files changed

+47
-46
lines changed

lightning/src/events/mod.rs

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,7 @@ pub enum Event {
859859
/// The `(channel_id, user_channel_id)` pairs over which the payment was received.
860860
///
861861
/// This will be an incomplete vector for MPP payment events created/serialized using LDK version 0.1.0 and prior.
862-
via_channel_ids: Vec<(ChannelId, Option<u128>)>,
862+
receiving_channel_ids: Vec<(ChannelId, Option<u128>)>,
863863
/// The block height at which this payment will be failed back and will no longer be
864864
/// eligible for claiming.
865865
///
@@ -1708,7 +1708,7 @@ impl Writeable for Event {
17081708
counterparty_skimmed_fee_msat,
17091709
ref purpose,
17101710
ref receiver_node_id,
1711-
ref via_channel_ids,
1711+
ref receiving_channel_ids,
17121712
ref claim_deadline,
17131713
ref onion_fields,
17141714
ref payment_id,
@@ -1753,30 +1753,31 @@ impl Writeable for Event {
17531753
Some(counterparty_skimmed_fee_msat)
17541754
};
17551755

1756-
let (via_channel_id_legacy, via_user_channel_id_legacy) =
1757-
match via_channel_ids.last() {
1756+
let (receiving_channel_id_legacy, receiving_user_channel_id_legacy) =
1757+
match receiving_channel_ids.last() {
17581758
Some((chan_id, user_chan_id)) => (Some(*chan_id), *user_chan_id),
17591759
None => (None, None),
17601760
};
17611761
write_tlv_fields!(writer, {
17621762
(0, payment_hash, required),
17631763
(1, receiver_node_id, option),
17641764
(2, payment_secret, option),
1765-
// Marked as legacy in version 0.2.0; superseded by `via_channel_ids`, which
1766-
// includes all channel IDs used in the payment instead of only the last one.
1767-
(3, via_channel_id_legacy, option),
1765+
// Marked as legacy in version 0.2.0; superseded by `receiving_channel_ids`,
1766+
// which includes all channel IDs used in the payment instead of only the last
1767+
// one.
1768+
(3, receiving_channel_id_legacy, option),
17681769
(4, amount_msat, required),
1769-
// Marked as legacy in version 0.2.0 for the same reason as `via_channel_id_legacy`;
1770-
// superseded by `via_user_channel_ids`.
1771-
(5, via_user_channel_id_legacy, option),
1770+
// Marked as legacy in version 0.2.0 for the same reason as
1771+
// `receiving_channel_id_legacy`; superseded by `receiving_channel_ids`.
1772+
(5, receiving_user_channel_id_legacy, option),
17721773
// Type 6 was `user_payment_id` on 0.0.103 and earlier
17731774
(7, claim_deadline, option),
17741775
(8, payment_preimage, option),
17751776
(9, onion_fields, option),
17761777
(10, skimmed_fee_opt, option),
17771778
(11, payment_context, option),
17781779
(13, payment_id, option),
1779-
(15, *via_channel_ids, optional_vec),
1780+
(15, *receiving_channel_ids, optional_vec),
17801781
});
17811782
},
17821783
&Event::PaymentSent {
@@ -2154,28 +2155,28 @@ impl MaybeReadable for Event {
21542155
let mut counterparty_skimmed_fee_msat_opt = None;
21552156
let mut receiver_node_id = None;
21562157
let mut _user_payment_id = None::<u64>; // Used in 0.0.103 and earlier, no longer written in 0.0.116+.
2157-
let mut via_channel_id_legacy = None;
2158+
let mut receiving_channel_id_legacy = None;
21582159
let mut claim_deadline = None;
2159-
let mut via_user_channel_id_legacy = None;
2160+
let mut receiving_user_channel_id_legacy = None;
21602161
let mut onion_fields = None;
21612162
let mut payment_context = None;
21622163
let mut payment_id = None;
2163-
let mut via_channel_ids_opt = None;
2164+
let mut receiving_channel_ids_opt = None;
21642165
read_tlv_fields!(reader, {
21652166
(0, payment_hash, required),
21662167
(1, receiver_node_id, option),
21672168
(2, payment_secret, option),
2168-
(3, via_channel_id_legacy, option),
2169+
(3, receiving_channel_id_legacy, option),
21692170
(4, amount_msat, required),
2170-
(5, via_user_channel_id_legacy, option),
2171+
(5, receiving_user_channel_id_legacy, option),
21712172
(6, _user_payment_id, option),
21722173
(7, claim_deadline, option),
21732174
(8, payment_preimage, option),
21742175
(9, onion_fields, option),
21752176
(10, counterparty_skimmed_fee_msat_opt, option),
21762177
(11, payment_context, option),
21772178
(13, payment_id, option),
2178-
(15, via_channel_ids_opt, optional_vec),
2179+
(15, receiving_channel_ids_opt, optional_vec),
21792180
});
21802181
let purpose = match payment_secret {
21812182
Some(secret) => {
@@ -2188,10 +2189,10 @@ impl MaybeReadable for Event {
21882189
None => return Err(msgs::DecodeError::InvalidValue),
21892190
};
21902191

2191-
let via_channel_ids = via_channel_ids_opt
2192+
let receiving_channel_ids = receiving_channel_ids_opt
21922193
.or_else(|| {
2193-
via_channel_id_legacy
2194-
.map(|chan_id| vec![(chan_id, via_user_channel_id_legacy)])
2194+
receiving_channel_id_legacy
2195+
.map(|chan_id| vec![(chan_id, receiving_user_channel_id_legacy)])
21952196
})
21962197
.unwrap_or_default();
21972198

@@ -2202,7 +2203,7 @@ impl MaybeReadable for Event {
22022203
counterparty_skimmed_fee_msat: counterparty_skimmed_fee_msat_opt
22032204
.unwrap_or(0),
22042205
purpose,
2205-
via_channel_ids,
2206+
receiving_channel_ids,
22062207
claim_deadline,
22072208
onion_fields,
22082209
payment_id,

lightning/src/ln/blinded_payment_tests.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -255,18 +255,18 @@ fn mpp_to_one_hop_blinded_path() {
255255
Some(payment_secret), ev.clone(), true, None);
256256

257257
match event.unwrap() {
258-
Event::PaymentClaimable { mut via_channel_ids, .. } => {
259-
let mut expected_via_channel_ids = nodes[3].node.list_channels()
258+
Event::PaymentClaimable { mut receiving_channel_ids, .. } => {
259+
let mut expected_receiving_channel_ids = nodes[3].node.list_channels()
260260
.iter()
261261
.map(|d| (d.channel_id, Some(d.user_channel_id)))
262262
.collect::<Vec<(_, _)>>();
263263

264264
// `list_channels` returns channels in arbitrary order, so we sort both vectors
265265
// to ensure the comparison is order-agnostic.
266-
via_channel_ids.sort();
267-
expected_via_channel_ids.sort();
266+
receiving_channel_ids.sort();
267+
expected_receiving_channel_ids.sort();
268268

269-
assert_eq!(via_channel_ids, expected_via_channel_ids);
269+
assert_eq!(receiving_channel_ids, expected_receiving_channel_ids);
270270
}
271271
_ => panic!("Unexpected event"),
272272
}

lightning/src/ln/chanmon_update_fail_tests.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -218,13 +218,13 @@ fn do_test_simple_monitor_temporary_update_fail(disconnect: bool) {
218218
ref purpose,
219219
amount_msat,
220220
receiver_node_id,
221-
ref via_channel_ids,
221+
ref receiving_channel_ids,
222222
..
223223
} => {
224224
assert_eq!(payment_hash_1, *payment_hash);
225225
assert_eq!(amount_msat, 1_000_000);
226226
assert_eq!(receiver_node_id.unwrap(), node_b_id);
227-
assert_eq!(*via_channel_ids, &[(channel_id, Some(user_channel_id))]);
227+
assert_eq!(*receiving_channel_ids, &[(channel_id, Some(user_channel_id))]);
228228
match &purpose {
229229
PaymentPurpose::Bolt11InvoicePayment {
230230
payment_preimage, payment_secret, ..
@@ -660,13 +660,13 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
660660
ref purpose,
661661
amount_msat,
662662
receiver_node_id,
663-
ref via_channel_ids,
663+
ref receiving_channel_ids,
664664
..
665665
} => {
666666
assert_eq!(payment_hash_2, *payment_hash);
667667
assert_eq!(amount_msat, 1_000_000);
668668
assert_eq!(receiver_node_id.unwrap(), node_b_id);
669-
assert_eq!(*via_channel_ids, [(channel_id, Some(user_channel_id))]);
669+
assert_eq!(*receiving_channel_ids, [(channel_id, Some(user_channel_id))]);
670670
match &purpose {
671671
PaymentPurpose::Bolt11InvoicePayment {
672672
payment_preimage, payment_secret, ..
@@ -795,13 +795,13 @@ fn test_monitor_update_fail_cs() {
795795
ref purpose,
796796
amount_msat,
797797
receiver_node_id,
798-
ref via_channel_ids,
798+
ref receiving_channel_ids,
799799
..
800800
} => {
801801
assert_eq!(payment_hash, our_payment_hash);
802802
assert_eq!(amount_msat, 1_000_000);
803803
assert_eq!(receiver_node_id.unwrap(), node_b_id);
804-
assert_eq!(*via_channel_ids, [(channel_id, Some(user_channel_id))]);
804+
assert_eq!(*receiving_channel_ids, [(channel_id, Some(user_channel_id))]);
805805
match &purpose {
806806
PaymentPurpose::Bolt11InvoicePayment {
807807
payment_preimage, payment_secret, ..
@@ -1906,13 +1906,13 @@ fn test_monitor_update_fail_claim() {
19061906
ref purpose,
19071907
amount_msat,
19081908
receiver_node_id,
1909-
ref via_channel_ids,
1909+
ref receiving_channel_ids,
19101910
..
19111911
} => {
19121912
assert_eq!(payment_hash_2, *payment_hash);
19131913
assert_eq!(1_000_000, amount_msat);
19141914
assert_eq!(receiver_node_id.unwrap(), node_a_id);
1915-
assert_eq!(*via_channel_ids.last().unwrap(), (channel_id, Some(42)));
1915+
assert_eq!(*receiving_channel_ids.last().unwrap(), (channel_id, Some(42)));
19161916
match &purpose {
19171917
PaymentPurpose::Bolt11InvoicePayment {
19181918
payment_preimage, payment_secret, ..
@@ -1931,13 +1931,13 @@ fn test_monitor_update_fail_claim() {
19311931
ref purpose,
19321932
amount_msat,
19331933
receiver_node_id,
1934-
ref via_channel_ids,
1934+
ref receiving_channel_ids,
19351935
..
19361936
} => {
19371937
assert_eq!(payment_hash_3, *payment_hash);
19381938
assert_eq!(1_000_000, amount_msat);
19391939
assert_eq!(receiver_node_id.unwrap(), node_a_id);
1940-
assert_eq!(*via_channel_ids, [(channel_id, Some(42))]);
1940+
assert_eq!(*receiving_channel_ids, [(channel_id, Some(42))]);
19411941
match &purpose {
19421942
PaymentPurpose::Bolt11InvoicePayment {
19431943
payment_preimage, payment_secret, ..

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,7 +960,7 @@ impl ClaimablePayment {
960960
/// Returns the inbound `(channel_id, user_channel_id)` pairs for all HTLCs associated with the payment.
961961
///
962962
/// Note: The `user_channel_id` will be `None` for HTLCs created using LDK version 0.0.117 or prior.
963-
fn via_channel_ids(&self) -> Vec<(ChannelId, Option<u128>)> {
963+
fn receiving_channel_ids(&self) -> Vec<(ChannelId, Option<u128>)> {
964964
self.htlcs
965965
.iter()
966966
.map(|htlc| (htlc.prev_hop.channel_id, htlc.prev_hop.user_channel_id))
@@ -7168,7 +7168,7 @@ where
71687168
purpose: $purpose,
71697169
amount_msat,
71707170
counterparty_skimmed_fee_msat,
7171-
via_channel_ids: claimable_payment.via_channel_ids(),
7171+
receiving_channel_ids: claimable_payment.receiving_channel_ids(),
71727172
claim_deadline: Some(earliest_expiry - HTLC_FAIL_BACK_BUFFER),
71737173
onion_fields: claimable_payment.onion_fields.clone(),
71747174
payment_id: Some(payment_id),

lightning/src/ln/functional_test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3357,7 +3357,7 @@ pub fn do_pass_along_path<'a, 'b, 'c>(args: PassAlongPathArgs) -> Option<Event>
33573357
ref purpose,
33583358
amount_msat,
33593359
receiver_node_id,
3360-
ref via_channel_ids,
3360+
ref receiving_channel_ids,
33613361
claim_deadline,
33623362
onion_fields,
33633363
..
@@ -3421,7 +3421,7 @@ pub fn do_pass_along_path<'a, 'b, 'c>(args: PassAlongPathArgs) -> Option<Event>
34213421
}
34223422
assert_eq!(*amount_msat, recv_value);
34233423
let channels = node.node.list_channels();
3424-
for (chan_id, user_chan_id) in via_channel_ids {
3424+
for (chan_id, user_chan_id) in receiving_channel_ids {
34253425
let chan = channels
34263426
.iter()
34273427
.find(|details| &details.channel_id == chan_id)

lightning/src/ln/functional_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3174,13 +3174,13 @@ fn do_test_drop_messages_peer_disconnect(messages_delivered: u8, simulate_broken
31743174
ref purpose,
31753175
amount_msat,
31763176
receiver_node_id,
3177-
ref via_channel_ids,
3177+
ref receiving_channel_ids,
31783178
..
31793179
} => {
31803180
assert_eq!(payment_hash_1, *payment_hash);
31813181
assert_eq!(amount_msat, 1_000_000);
31823182
assert_eq!(receiver_node_id.unwrap(), node_b_id);
3183-
assert_eq!(*via_channel_ids, vec![(channel_id, Some(user_channel_id))]);
3183+
assert_eq!(*receiving_channel_ids, vec![(channel_id, Some(user_channel_id))]);
31843184
match &purpose {
31853185
PaymentPurpose::Bolt11InvoicePayment {
31863186
payment_preimage, payment_secret, ..

lightning/src/ln/htlc_reserve_unit_tests.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,13 @@ pub fn test_channel_reserve_holding_cell_htlcs() {
375375
ref purpose,
376376
amount_msat,
377377
receiver_node_id,
378-
ref via_channel_ids,
378+
ref receiving_channel_ids,
379379
..
380380
} => {
381381
assert_eq!(our_payment_hash_21, *payment_hash);
382382
assert_eq!(recv_value_21, amount_msat);
383383
assert_eq!(node_c_id, receiver_node_id.unwrap());
384-
assert_eq!(*via_channel_ids, vec![(chan_2.2, Some(chan_2_user_id))]);
384+
assert_eq!(*receiving_channel_ids, vec![(chan_2.2, Some(chan_2_user_id))]);
385385
match &purpose {
386386
PaymentPurpose::Bolt11InvoicePayment {
387387
payment_preimage, payment_secret, ..
@@ -400,13 +400,13 @@ pub fn test_channel_reserve_holding_cell_htlcs() {
400400
ref purpose,
401401
amount_msat,
402402
receiver_node_id,
403-
ref via_channel_ids,
403+
ref receiving_channel_ids,
404404
..
405405
} => {
406406
assert_eq!(our_payment_hash_22, *payment_hash);
407407
assert_eq!(recv_value_22, amount_msat);
408408
assert_eq!(node_c_id, receiver_node_id.unwrap());
409-
assert_eq!(*via_channel_ids, vec![(chan_2.2, Some(chan_2_user_id))]);
409+
assert_eq!(*receiving_channel_ids, vec![(chan_2.2, Some(chan_2_user_id))]);
410410
match &purpose {
411411
PaymentPurpose::Bolt11InvoicePayment {
412412
payment_preimage, payment_secret, ..

0 commit comments

Comments
 (0)