@@ -1746,9 +1746,9 @@ pub struct FinalOnionHopData {
1746
1746
1747
1747
mod fuzzy_internal_msgs {
1748
1748
use bitcoin:: secp256k1:: PublicKey ;
1749
- use crate :: blinded_path:: payment:: { PaymentConstraints , PaymentContext , PaymentRelay } ;
1749
+ use crate :: blinded_path:: payment:: { BlindedPaymentPath , PaymentConstraints , PaymentContext , PaymentRelay } ;
1750
1750
use crate :: types:: payment:: { PaymentPreimage , PaymentSecret } ;
1751
- use crate :: types:: features:: BlindedHopFeatures ;
1751
+ use crate :: types:: features:: { BlindedHopFeatures , Bolt12InvoiceFeatures } ;
1752
1752
use super :: { FinalOnionHopData , TrampolineOnionPacket } ;
1753
1753
1754
1754
#[ allow( unused_imports) ]
@@ -1836,9 +1836,21 @@ mod fuzzy_internal_msgs {
1836
1836
/// The value, in msat, of the payment after this hop's fee is deducted.
1837
1837
amt_to_forward : u64 ,
1838
1838
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.
1840
1840
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
+ } ,
1842
1854
}
1843
1855
1844
1856
pub struct DecodedOnionErrorPacket {
@@ -2763,7 +2775,26 @@ impl Writeable for OutboundTrampolinePayload {
2763
2775
( 4 , HighZeroBytesDroppedBigSize ( * outgoing_cltv_value) , required) ,
2764
2776
( 14 , outgoing_node_id, required)
2765
2777
} ) ;
2766
- }
2778
+ } ,
2779
+ Self :: LegacyBlindedPathEntry { amt_to_forward, outgoing_cltv_value, payment_paths, invoice_features } => {
2780
+ let mut blinded_path_serialization = [ 0u8 ; 2048 ] ; // Fixed-length buffer on the stack
2781
+ let serialization_length = {
2782
+ let buffer_size = blinded_path_serialization. len ( ) ;
2783
+ let mut blinded_path_slice = & mut blinded_path_serialization[ ..] ;
2784
+ for current_payment_path in payment_paths {
2785
+ current_payment_path. inner_blinded_path ( ) . write ( & mut blinded_path_slice) ?;
2786
+ current_payment_path. payinfo . write ( & mut blinded_path_slice) ?;
2787
+ }
2788
+ buffer_size - blinded_path_slice. len ( )
2789
+ } ;
2790
+ let blinded_path_serialization = & blinded_path_serialization[ ..serialization_length] ;
2791
+ _encode_varint_length_prefixed_tlv ! ( w, {
2792
+ ( 2 , HighZeroBytesDroppedBigSize ( * amt_to_forward) , required) ,
2793
+ ( 4 , HighZeroBytesDroppedBigSize ( * outgoing_cltv_value) , required) ,
2794
+ ( 21 , invoice_features. as_ref( ) . map( |m| WithoutLength ( m) ) , option) ,
2795
+ ( 22 , WithoutLength ( blinded_path_serialization) , required)
2796
+ } ) ;
2797
+ } ,
2767
2798
}
2768
2799
Ok ( ( ) )
2769
2800
}
0 commit comments