@@ -3217,7 +3217,7 @@ mod tests {
3217
3217
use hex:: DisplayHex ;
3218
3218
use crate :: ln:: types:: { ChannelId , PaymentPreimage , PaymentHash , PaymentSecret } ;
3219
3219
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 } ;
3221
3221
use crate :: ln:: msgs:: SocketAddress ;
3222
3222
use crate :: routing:: gossip:: { NodeAlias , NodeId } ;
3223
3223
use crate :: util:: ser:: { BigSize , FixedLengthReader , Hostname , LengthReadable , Readable , ReadableArgs , TransactionU16LenLimited , Writeable } ;
@@ -3243,6 +3243,7 @@ mod tests {
3243
3243
3244
3244
#[ cfg( feature = "std" ) ]
3245
3245
use std:: net:: { Ipv4Addr , Ipv6Addr , SocketAddr , SocketAddrV4 , SocketAddrV6 , ToSocketAddrs } ;
3246
+ use crate :: blinded_path:: { BlindedPath , Direction , IntroductionNode } ;
3246
3247
#[ cfg( feature = "std" ) ]
3247
3248
use crate :: ln:: msgs:: SocketAddressParseError ;
3248
3249
@@ -4585,6 +4586,25 @@ mod tests {
4585
4586
assert_eq ! ( encoded_trampoline_packet, expected_eclair_trampoline_packet) ;
4586
4587
}
4587
4588
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
+
4588
4608
#[ test]
4589
4609
fn query_channel_range_end_blocknum ( ) {
4590
4610
let tests: Vec < ( u32 , u32 , u32 ) > = vec ! [
0 commit comments