@@ -774,10 +774,16 @@ pub enum Event {
774774 /// Information for claiming this received payment, based on whether the purpose of the
775775 /// payment is to pay an invoice or to send a spontaneous payment.
776776 purpose : PaymentPurpose ,
777- /// The `channel_id` indicating over which channel we received the payment.
778- via_channel_id : Option < ChannelId > ,
779- /// The `user_channel_id` indicating over which channel we received the payment.
780- via_user_channel_id : Option < u128 > ,
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.
781+ via_channel_ids : Vec < Option < 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.
786+ via_user_channel_ids : Vec < Option < u128 > > ,
781787 /// The block height at which this payment will be failed back and will no longer be
782788 /// eligible for claiming.
783789 ///
@@ -1506,7 +1512,7 @@ impl Writeable for Event {
15061512 // drop any channels which have not yet exchanged funding_signed.
15071513 } ,
15081514 & Event :: PaymentClaimable { ref payment_hash, ref amount_msat, counterparty_skimmed_fee_msat,
1509- ref purpose, ref receiver_node_id, ref via_channel_id , ref via_user_channel_id ,
1515+ ref purpose, ref receiver_node_id, ref via_channel_ids , ref via_user_channel_ids ,
15101516 ref claim_deadline, ref onion_fields, ref payment_id,
15111517 } => {
15121518 1u8 . write ( writer) ?;
@@ -1544,16 +1550,20 @@ impl Writeable for Event {
15441550 ( 0 , payment_hash, required) ,
15451551 ( 1 , receiver_node_id, option) ,
15461552 ( 2 , payment_secret, option) ,
1547- ( 3 , via_channel_id, option) ,
1553+ // legacy field
1554+ // (3, via_channel_id, option),
15481555 ( 4 , amount_msat, required) ,
1549- ( 5 , via_user_channel_id, option) ,
1556+ // legacy field
1557+ // (5, via_user_channel_id, option),
15501558 // Type 6 was `user_payment_id` on 0.0.103 and earlier
15511559 ( 7 , claim_deadline, option) ,
15521560 ( 8 , payment_preimage, option) ,
15531561 ( 9 , onion_fields, option) ,
15541562 ( 10 , skimmed_fee_opt, option) ,
15551563 ( 11 , payment_context, option) ,
15561564 ( 13 , payment_id, option) ,
1565+ ( 15 , * via_channel_ids, optional_vec) ,
1566+ ( 17 , * via_user_channel_ids, optional_vec) ,
15571567 } ) ;
15581568 } ,
15591569 & Event :: PaymentSent { ref payment_id, ref payment_preimage, ref payment_hash, ref amount_msat, ref fee_paid_msat } => {
@@ -1855,6 +1865,8 @@ impl MaybeReadable for Event {
18551865 let mut onion_fields = None ;
18561866 let mut payment_context = None ;
18571867 let mut payment_id = None ;
1868+ let mut via_channel_ids_opt = None ;
1869+ let mut via_user_channel_ids_opt = None ;
18581870 read_tlv_fields ! ( reader, {
18591871 ( 0 , payment_hash, required) ,
18601872 ( 1 , receiver_node_id, option) ,
@@ -1869,21 +1881,26 @@ impl MaybeReadable for Event {
18691881 ( 10 , counterparty_skimmed_fee_msat_opt, option) ,
18701882 ( 11 , payment_context, option) ,
18711883 ( 13 , payment_id, option) ,
1884+ ( 15 , via_channel_ids_opt, optional_vec) ,
1885+ ( 17 , via_user_channel_ids_opt, optional_vec) ,
18721886 } ) ;
18731887 let purpose = match payment_secret {
18741888 Some ( secret) => PaymentPurpose :: from_parts ( payment_preimage, secret, payment_context)
18751889 . map_err ( |( ) | msgs:: DecodeError :: InvalidValue ) ?,
18761890 None if payment_preimage. is_some ( ) => PaymentPurpose :: SpontaneousPayment ( payment_preimage. unwrap ( ) ) ,
18771891 None => return Err ( msgs:: DecodeError :: InvalidValue ) ,
18781892 } ;
1893+
1894+ let via_channel_ids = via_channel_ids_opt. unwrap_or ( vec ! [ via_channel_id] ) ;
1895+ let via_user_channel_ids = via_user_channel_ids_opt. unwrap_or ( vec ! [ via_user_channel_id] ) ;
18791896 Ok ( Some ( Event :: PaymentClaimable {
18801897 receiver_node_id,
18811898 payment_hash,
18821899 amount_msat,
18831900 counterparty_skimmed_fee_msat : counterparty_skimmed_fee_msat_opt. unwrap_or ( 0 ) ,
18841901 purpose,
1885- via_channel_id ,
1886- via_user_channel_id ,
1902+ via_channel_ids ,
1903+ via_user_channel_ids ,
18871904 claim_deadline,
18881905 onion_fields,
18891906 payment_id,
0 commit comments