@@ -260,6 +260,8 @@ pub struct ReceiveTlvs {
260
260
pub payment_constraints : PaymentConstraints ,
261
261
/// Context for the receiver of this payment.
262
262
pub payment_context : PaymentContext ,
263
+ /// Custom Tlvs
264
+ pub custom_tlvs : Vec < u8 > ,
263
265
}
264
266
265
267
/// Data to construct a [`BlindedHop`] for sending a payment over.
@@ -404,7 +406,8 @@ impl Writeable for ReceiveTlvs {
404
406
encode_tlv_stream ! ( w, {
405
407
( 12 , self . payment_constraints, required) ,
406
408
( 65536 , self . payment_secret, required) ,
407
- ( 65537 , self . payment_context, required)
409
+ ( 65537 , self . payment_context, required) ,
410
+ ( 65539 , self . custom_tlvs, ( default_value, Vec :: new( ) ) ) ,
408
411
} ) ;
409
412
Ok ( ( ) )
410
413
}
@@ -432,6 +435,7 @@ impl Readable for BlindedPaymentTlvs {
432
435
( 14 , features, ( option, encoding: ( BlindedHopFeatures , WithoutLength ) ) ) ,
433
436
( 65536 , payment_secret, option) ,
434
437
( 65537 , payment_context, ( default_value, PaymentContext :: unknown( ) ) ) ,
438
+ ( 65539 , custom_tlvs, ( default_value, Vec :: new( ) ) )
435
439
} ) ;
436
440
let _padding: Option < utils:: Padding > = _padding;
437
441
@@ -452,6 +456,7 @@ impl Readable for BlindedPaymentTlvs {
452
456
payment_secret : payment_secret. ok_or ( DecodeError :: InvalidValue ) ?,
453
457
payment_constraints : payment_constraints. 0 . unwrap ( ) ,
454
458
payment_context : payment_context. 0 . unwrap ( ) ,
459
+ custom_tlvs : custom_tlvs. 0 . unwrap ( ) ,
455
460
} ) )
456
461
}
457
462
}
@@ -683,6 +688,7 @@ mod tests {
683
688
htlc_minimum_msat : 1 ,
684
689
} ,
685
690
payment_context : PaymentContext :: unknown ( ) ,
691
+ custom_tlvs : Vec :: new ( ) ,
686
692
} ;
687
693
let htlc_maximum_msat = 100_000 ;
688
694
let blinded_payinfo = super :: compute_payinfo ( & intermediate_nodes[ ..] , & recv_tlvs, htlc_maximum_msat, 12 ) . unwrap ( ) ;
@@ -702,6 +708,7 @@ mod tests {
702
708
htlc_minimum_msat : 1 ,
703
709
} ,
704
710
payment_context : PaymentContext :: unknown ( ) ,
711
+ custom_tlvs : Vec :: new ( ) ,
705
712
} ;
706
713
let blinded_payinfo = super :: compute_payinfo ( & [ ] , & recv_tlvs, 4242 , TEST_FINAL_CLTV as u16 ) . unwrap ( ) ;
707
714
assert_eq ! ( blinded_payinfo. fee_base_msat, 0 ) ;
@@ -758,6 +765,7 @@ mod tests {
758
765
htlc_minimum_msat : 3 ,
759
766
} ,
760
767
payment_context : PaymentContext :: unknown ( ) ,
768
+ custom_tlvs : Vec :: new ( ) ,
761
769
} ;
762
770
let htlc_maximum_msat = 100_000 ;
763
771
let blinded_payinfo = super :: compute_payinfo ( & intermediate_nodes[ ..] , & recv_tlvs, htlc_maximum_msat, TEST_FINAL_CLTV as u16 ) . unwrap ( ) ;
@@ -811,6 +819,7 @@ mod tests {
811
819
htlc_minimum_msat : 1 ,
812
820
} ,
813
821
payment_context : PaymentContext :: unknown ( ) ,
822
+ custom_tlvs : Vec :: new ( ) ,
814
823
} ;
815
824
let htlc_minimum_msat = 3798 ;
816
825
assert ! ( super :: compute_payinfo( & intermediate_nodes[ ..] , & recv_tlvs, htlc_minimum_msat - 1 , TEST_FINAL_CLTV as u16 ) . is_err( ) ) ;
@@ -868,6 +877,7 @@ mod tests {
868
877
htlc_minimum_msat : 1 ,
869
878
} ,
870
879
payment_context : PaymentContext :: unknown ( ) ,
880
+ custom_tlvs : Vec :: new ( )
871
881
} ;
872
882
873
883
let blinded_payinfo = super :: compute_payinfo ( & intermediate_nodes[ ..] , & recv_tlvs, 10_000 , TEST_FINAL_CLTV as u16 ) . unwrap ( ) ;
0 commit comments