@@ -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,20 @@ 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: Vec < u8 > = Vec :: with_capacity ( 2048 ) ;
2781
+ for current_payment_path in payment_paths {
2782
+ current_payment_path. inner_blinded_path ( ) . write ( & mut blinded_path_serialization) ?;
2783
+ current_payment_path. payinfo . write ( & mut blinded_path_serialization) ?;
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
+ ( 22 , WithoutLength ( & blinded_path_serialization) , required)
2790
+ } ) ;
2791
+ } ,
2767
2792
}
2768
2793
Ok ( ( ) )
2769
2794
}
0 commit comments