@@ -1746,9 +1746,9 @@ pub struct FinalOnionHopData {
17461746
17471747mod fuzzy_internal_msgs {
17481748 use bitcoin:: secp256k1:: PublicKey ;
1749- use crate :: blinded_path:: payment:: { PaymentConstraints , PaymentContext , PaymentRelay } ;
1749+ use crate :: blinded_path:: payment:: { BlindedPaymentPath , PaymentConstraints , PaymentContext , PaymentRelay } ;
17501750 use crate :: types:: payment:: { PaymentPreimage , PaymentSecret } ;
1751- use crate :: types:: features:: BlindedHopFeatures ;
1751+ use crate :: types:: features:: { BlindedHopFeatures , Bolt12InvoiceFeatures } ;
17521752 use super :: { FinalOnionHopData , TrampolineOnionPacket } ;
17531753
17541754 #[ allow( unused_imports) ]
@@ -1836,9 +1836,21 @@ mod fuzzy_internal_msgs {
18361836 /// The value, in msat, of the payment after this hop's fee is deducted.
18371837 amt_to_forward : u64 ,
18381838 outgoing_cltv_value : u32 ,
1839- /// The node id to which the trampoline node must find a route
1839+ /// The node id to which the trampoline node must find a route.
18401840 outgoing_node_id : PublicKey ,
1841- }
1841+ } ,
1842+ #[ allow( unused) ]
1843+ /// This is the last Trampoline hop, whereupon the Trampoline forward mechanism is exited,
1844+ /// and payment data is relayed using non-Trampoline blinded hops
1845+ LegacyBlindedPathEntry {
1846+ /// The value, in msat, of the payment after this hop's fee is deducted.
1847+ amt_to_forward : u64 ,
1848+ outgoing_cltv_value : u32 ,
1849+ /// List of blinded path options the last trampoline hop may choose to route through.
1850+ payment_paths : Vec < BlindedPaymentPath > ,
1851+ /// If applicable, features of the BOLT12 invoice being paid.
1852+ invoice_features : Option < Bolt12InvoiceFeatures > ,
1853+ } ,
18421854 }
18431855
18441856 pub struct DecodedOnionErrorPacket {
@@ -2763,7 +2775,19 @@ impl Writeable for OutboundTrampolinePayload {
27632775 ( 4 , HighZeroBytesDroppedBigSize ( * outgoing_cltv_value) , required) ,
27642776 ( 14 , outgoing_node_id, required)
27652777 } ) ;
2766- }
2778+ } ,
2779+ Self :: LegacyBlindedPathEntry { amt_to_forward, outgoing_cltv_value, payment_paths, invoice_features } => {
2780+ let blinded_path_value: Vec < u8 > = payment_paths. iter ( ) . flat_map ( |p| {
2781+ p. inner_blinded_path ( ) . encode ( ) . into_iter ( ) . chain ( p. payinfo . encode ( ) )
2782+ } ) . collect ( ) ;
2783+ let blinded_path_tlv = ( 22 , blinded_path_value) ;
2784+
2785+ _encode_varint_length_prefixed_tlv ! ( w, {
2786+ ( 2 , HighZeroBytesDroppedBigSize ( * amt_to_forward) , required) ,
2787+ ( 4 , HighZeroBytesDroppedBigSize ( * outgoing_cltv_value) , required) ,
2788+ ( 21 , invoice_features. as_ref( ) . map( |m| WithoutLength ( m) ) , option)
2789+ } , [ & blinded_path_tlv] ) ;
2790+ } ,
27672791 }
27682792 Ok ( ( ) )
27692793 }
0 commit comments