@@ -3326,7 +3326,7 @@ mod tests {
33263326 use crate :: ln:: types:: ChannelId ;
33273327 use crate :: types:: payment:: { PaymentPreimage , PaymentHash , PaymentSecret } ;
33283328 use crate :: types:: features:: { ChannelFeatures , ChannelTypeFeatures , InitFeatures , NodeFeatures } ;
3329- use crate :: ln:: msgs:: { self , FinalOnionHopData , OnionErrorPacket , CommonOpenChannelFields , CommonAcceptChannelFields , TrampolineOnionPacket } ;
3329+ use crate :: ln:: msgs:: { self , FinalOnionHopData , OnionErrorPacket , CommonOpenChannelFields , CommonAcceptChannelFields , OutboundTrampolinePayload , TrampolineOnionPacket } ;
33303330 use crate :: ln:: msgs:: SocketAddress ;
33313331 use crate :: routing:: gossip:: { NodeAlias , NodeId } ;
33323332 use crate :: util:: ser:: { BigSize , FixedLengthReader , Hostname , LengthReadable , Readable , ReadableArgs , TransactionU16LenLimited , Writeable } ;
@@ -3352,6 +3352,7 @@ mod tests {
33523352
33533353 #[ cfg( feature = "std" ) ]
33543354 use std:: net:: { Ipv4Addr , Ipv6Addr , SocketAddr , SocketAddrV4 , SocketAddrV6 , ToSocketAddrs } ;
3355+ use crate :: blinded_path:: { BlindedPath , Direction , IntroductionNode } ;
33553356 #[ cfg( feature = "std" ) ]
33563357 use crate :: ln:: msgs:: SocketAddressParseError ;
33573358
@@ -4699,6 +4700,25 @@ mod tests {
46994700 assert_eq ! ( encoded_trampoline_packet, expected_eclair_trampoline_packet) ;
47004701 }
47014702
4703+ #[ test]
4704+ fn encoding_outbound_trampoline_payload ( ) {
4705+ let public_key = PublicKey :: from_slice ( & <Vec < u8 > >:: from_hex ( "02eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f283686619" ) . unwrap ( ) ) . unwrap ( ) ;
4706+ let trampoline_payload = OutboundTrampolinePayload :: BlindedForward {
4707+ amt_to_forward : 100000000 ,
4708+ outgoing_cltv_value : 800000 ,
4709+ payment_paths : vec ! [
4710+ BlindedPath {
4711+ introduction_node: IntroductionNode :: DirectedShortChannelId ( Direction :: NodeOne , 12 ) ,
4712+ blinding_point: public_key,
4713+ blinded_hops: vec![ ] ,
4714+ }
4715+ ] ,
4716+ invoice_features : None ,
4717+ } ;
4718+ let serialized_payload = trampoline_payload. encode ( ) . to_lower_hex_string ( ) ;
4719+ assert_eq ! ( serialized_payload, "3c020405f5e10004030c3500fe000102362b00000000000000000c02eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f28368661900" ) ;
4720+ }
4721+
47024722 #[ test]
47034723 fn query_channel_range_end_blocknum ( ) {
47044724 let tests: Vec < ( u32 , u32 , u32 ) > = vec ! [
0 commit comments