@@ -3217,7 +3217,7 @@ mod tests {
32173217 use hex:: DisplayHex ;
32183218 use crate :: ln:: types:: { ChannelId , PaymentPreimage , PaymentHash , PaymentSecret } ;
32193219 use crate :: ln:: features:: { ChannelFeatures , ChannelTypeFeatures , InitFeatures , NodeFeatures } ;
3220- use crate :: ln:: msgs:: { self , FinalOnionHopData , OnionErrorPacket , CommonOpenChannelFields , CommonAcceptChannelFields , TrampolineOnionPacket } ;
3220+ use crate :: ln:: msgs:: { self , FinalOnionHopData , OnionErrorPacket , CommonOpenChannelFields , CommonAcceptChannelFields , TrampolineOnionPacket , OutboundTrampolinePayload } ;
32213221 use crate :: ln:: msgs:: SocketAddress ;
32223222 use crate :: routing:: gossip:: { NodeAlias , NodeId } ;
32233223 use crate :: util:: ser:: { BigSize , FixedLengthReader , Hostname , LengthReadable , Readable , ReadableArgs , TransactionU16LenLimited , Writeable } ;
@@ -3243,6 +3243,7 @@ mod tests {
32433243
32443244 #[ cfg( feature = "std" ) ]
32453245 use std:: net:: { Ipv4Addr , Ipv6Addr , SocketAddr , SocketAddrV4 , SocketAddrV6 , ToSocketAddrs } ;
3246+ use crate :: blinded_path:: { BlindedPath , Direction , IntroductionNode } ;
32463247 #[ cfg( feature = "std" ) ]
32473248 use crate :: ln:: msgs:: SocketAddressParseError ;
32483249
@@ -4585,6 +4586,25 @@ mod tests {
45854586 assert_eq ! ( encoded_trampoline_packet, expected_eclair_trampoline_packet) ;
45864587 }
45874588
4589+ #[ test]
4590+ fn encoding_outbound_trampoline_payload ( ) {
4591+ let public_key = PublicKey :: from_slice ( & <Vec < u8 > >:: from_hex ( "02eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f283686619" ) . unwrap ( ) ) . unwrap ( ) ;
4592+ let trampoline_payload = OutboundTrampolinePayload :: BlindedForward {
4593+ amt_to_forward : 100000000 ,
4594+ outgoing_cltv_value : 800000 ,
4595+ payment_paths : vec ! [
4596+ BlindedPath {
4597+ introduction_node: IntroductionNode :: DirectedShortChannelId ( Direction :: NodeOne , 12 ) ,
4598+ blinding_point: public_key,
4599+ blinded_hops: vec![ ] ,
4600+ }
4601+ ] ,
4602+ invoice_features : None ,
4603+ } ;
4604+ let serialized_payload = trampoline_payload. encode ( ) . to_lower_hex_string ( ) ;
4605+ assert_eq ! ( serialized_payload, "3c020405f5e10004030c3500fe000102362b00000000000000000c02eec7245d6b7d2ccb30380bfbe2a3648cd7a942653f5aa340edcea1f28368661900" ) ;
4606+ }
4607+
45884608 #[ test]
45894609 fn query_channel_range_end_blocknum ( ) {
45904610 let tests: Vec < ( u32 , u32 , u32 ) > = vec ! [
0 commit comments