@@ -1749,6 +1749,7 @@ mod fuzzy_internal_msgs {
1749
1749
use crate :: blinded_path:: payment:: { PaymentConstraints , PaymentContext , PaymentRelay } ;
1750
1750
use crate :: ln:: types:: { PaymentPreimage , PaymentSecret } ;
1751
1751
use crate :: ln:: features:: BlindedHopFeatures ;
1752
+ use crate :: offers:: invoice_request:: InvoiceRequest ;
1752
1753
use super :: { FinalOnionHopData , TrampolineOnionPacket } ;
1753
1754
1754
1755
#[ allow( unused_imports) ]
@@ -1827,6 +1828,7 @@ mod fuzzy_internal_msgs {
1827
1828
intro_node_blinding_point : Option < PublicKey > , // Set if the introduction node of the blinded path is the final node
1828
1829
keysend_preimage : Option < PaymentPreimage > ,
1829
1830
custom_tlvs : & ' a Vec < ( u64 , Vec < u8 > ) > ,
1831
+ invoice_request : Option < & ' a InvoiceRequest > ,
1830
1832
}
1831
1833
}
1832
1834
@@ -2687,6 +2689,9 @@ impl Readable for FinalOnionHopData {
2687
2689
}
2688
2690
}
2689
2691
2692
+ // This TLV type isn't stabilized in the BOLTs.
2693
+ const ONION_INVREQ_TLV_TYPE : u64 = 77_777 ;
2694
+
2690
2695
impl < ' a > Writeable for OutboundOnionPayload < ' a > {
2691
2696
fn write < W : Writer > ( & self , w : & mut W ) -> Result < ( ) , io:: Error > {
2692
2697
match self {
@@ -2733,13 +2738,17 @@ impl<'a> Writeable for OutboundOnionPayload<'a> {
2733
2738
} ,
2734
2739
Self :: BlindedReceive {
2735
2740
sender_intended_htlc_amt_msat, total_msat, cltv_expiry_height, encrypted_tlvs,
2736
- intro_node_blinding_point, keysend_preimage, ref custom_tlvs,
2741
+ intro_node_blinding_point, keysend_preimage, ref invoice_request , ref custom_tlvs,
2737
2742
} => {
2738
2743
// We need to update [`ln::outbound_payment::RecipientOnionFields::with_custom_tlvs`]
2739
2744
// to reject any reserved types in the experimental range if new ones are ever
2740
2745
// standardized.
2746
+ let invoice_request_tlv = invoice_request. map ( |invreq| ( ONION_INVREQ_TLV_TYPE , invreq. encode ( ) ) ) ;
2741
2747
let keysend_tlv = keysend_preimage. map ( |preimage| ( 5482373484 , preimage. encode ( ) ) ) ;
2742
- let mut custom_tlvs: Vec < & ( u64 , Vec < u8 > ) > = custom_tlvs. iter ( ) . chain ( keysend_tlv. iter ( ) ) . collect ( ) ;
2748
+ let mut custom_tlvs: Vec < & ( u64 , Vec < u8 > ) > = custom_tlvs. iter ( )
2749
+ . chain ( invoice_request_tlv. iter ( ) )
2750
+ . chain ( keysend_tlv. iter ( ) )
2751
+ . collect ( ) ;
2743
2752
custom_tlvs. sort_unstable_by_key ( |( typ, _) | * typ) ;
2744
2753
_encode_varint_length_prefixed_tlv ! ( w, {
2745
2754
( 2 , HighZeroBytesDroppedBigSize ( * sender_intended_htlc_amt_msat) , required) ,
0 commit comments