@@ -774,15 +774,11 @@ pub enum Event {
774
774
/// Information for claiming this received payment, based on whether the purpose of the
775
775
/// payment is to pay an invoice or to send a spontaneous payment.
776
776
purpose: PaymentPurpose,
777
- /// The `channel_id`(s) indicating over which channel(s) we received the payment.
778
- /// - In a non-MPP scenario, this will contain a single `channel_id` where the payment was received.
779
- /// - In an MPP scenario, this will contain multiple `channel_id`s corresponding to the channels over
780
- /// which the payment parts were received.
777
+ /// The `channel_id`(s) over which the payment was received.
778
+ /// This will be an empty vector for events created/serialised using LDK version 0.0.112 and prior.
781
779
via_channel_ids: Vec<ChannelId>,
782
- /// The `user_channel_id`(s) indicating over which channel(s) we received the payment.
783
- /// - In a non-MPP scenario, this will contain a single `user_channel_id`.
784
- /// - In an MPP scenario, this will contain multiple `user_channel_id`s corresponding to the channels
785
- /// over which the payment parts were received.
780
+ /// The `user_channel_id`(s) corresponding to the channels over which the payment was received.
781
+ /// This will be an empty vector for HTLC events created/serialised using LDK version 0.0.112 and prior.
786
782
via_user_channel_ids: Vec<u128>,
787
783
/// The block height at which this payment will be failed back and will no longer be
788
784
/// eligible for claiming.
@@ -1546,15 +1542,16 @@ impl Writeable for Event {
1546
1542
}
1547
1543
let skimmed_fee_opt = if counterparty_skimmed_fee_msat == 0 { None }
1548
1544
else { Some(counterparty_skimmed_fee_msat) };
1545
+
1546
+ let via_channel_id_legacy = via_channel_ids.last().cloned();
1547
+ let via_user_channel_id_legacy = via_user_channel_ids.last().cloned();
1549
1548
write_tlv_fields!(writer, {
1550
1549
(0, payment_hash, required),
1551
1550
(1, receiver_node_id, option),
1552
1551
(2, payment_secret, option),
1553
- // legacy field
1554
- // (3, via_channel_id, option),
1552
+ (3, via_channel_id_legacy, option),
1555
1553
(4, amount_msat, required),
1556
- // legacy field
1557
- // (5, via_user_channel_id, option),
1554
+ (5, via_user_channel_id_legacy, option),
1558
1555
// Type 6 was `user_payment_id` on 0.0.103 and earlier
1559
1556
(7, claim_deadline, option),
1560
1557
(8, payment_preimage, option),
@@ -1859,9 +1856,9 @@ impl MaybeReadable for Event {
1859
1856
let mut counterparty_skimmed_fee_msat_opt = None;
1860
1857
let mut receiver_node_id = None;
1861
1858
let mut _user_payment_id = None::<u64>; // Used in 0.0.103 and earlier, no longer written in 0.0.116+.
1862
- let mut via_channel_id = None;
1859
+ let mut via_channel_id_legacy = None;
1863
1860
let mut claim_deadline = None;
1864
- let mut via_user_channel_id = None;
1861
+ let mut via_user_channel_id_legacy = None;
1865
1862
let mut onion_fields = None;
1866
1863
let mut payment_context = None;
1867
1864
let mut payment_id = None;
@@ -1871,9 +1868,9 @@ impl MaybeReadable for Event {
1871
1868
(0, payment_hash, required),
1872
1869
(1, receiver_node_id, option),
1873
1870
(2, payment_secret, option),
1874
- (3, via_channel_id , option),
1871
+ (3, via_channel_id_legacy , option),
1875
1872
(4, amount_msat, required),
1876
- (5, via_user_channel_id , option),
1873
+ (5, via_user_channel_id_legacy , option),
1877
1874
(6, _user_payment_id, option),
1878
1875
(7, claim_deadline, option),
1879
1876
(8, payment_preimage, option),
@@ -1892,11 +1889,11 @@ impl MaybeReadable for Event {
1892
1889
};
1893
1890
1894
1891
let via_channel_ids = via_channel_ids_opt
1895
- .or_else(|| via_channel_id .map(|id| vec![id]))
1892
+ .or_else(|| via_channel_id_legacy .map(|id| vec![id]))
1896
1893
.unwrap_or_default();
1897
1894
1898
1895
let via_user_channel_ids = via_user_channel_ids_opt
1899
- .or_else(|| via_user_channel_id .map(|id| vec![id]))
1896
+ .or_else(|| via_user_channel_id_legacy .map(|id| vec![id]))
1900
1897
.unwrap_or_default();
1901
1898
1902
1899
Ok(Some(Event::PaymentClaimable {
0 commit comments