@@ -3326,7 +3326,7 @@ mod tests {
3326
3326
use bitcoin:: hex:: DisplayHex ;
3327
3327
use crate :: ln:: types:: { ChannelId , PaymentPreimage , PaymentHash , PaymentSecret } ;
3328
3328
use crate :: ln:: 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 , TrampolineOnionPacket , OutboundTrampolinePayload } ;
3330
3330
use crate :: ln:: msgs:: SocketAddress ;
3331
3331
use crate :: routing:: gossip:: { NodeAlias , NodeId } ;
3332
3332
use crate :: util:: ser:: { BigSize , FixedLengthReader , Hostname , LengthReadable , Readable , ReadableArgs , TransactionU16LenLimited , Writeable } ;
@@ -3352,6 +3352,7 @@ mod tests {
3352
3352
3353
3353
#[ cfg( feature = "std" ) ]
3354
3354
use std:: net:: { Ipv4Addr , Ipv6Addr , SocketAddr , SocketAddrV4 , SocketAddrV6 , ToSocketAddrs } ;
3355
+ use crate :: blinded_path:: { BlindedPath , Direction , IntroductionNode } ;
3355
3356
#[ cfg( feature = "std" ) ]
3356
3357
use crate :: ln:: msgs:: SocketAddressParseError ;
3357
3358
@@ -4699,6 +4700,25 @@ mod tests {
4699
4700
assert_eq ! ( encoded_trampoline_packet, expected_eclair_trampoline_packet) ;
4700
4701
}
4701
4702
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
+
4702
4722
#[ test]
4703
4723
fn query_channel_range_end_blocknum ( ) {
4704
4724
let tests: Vec < ( u32 , u32 , u32 ) > = vec ! [
0 commit comments