@@ -1016,6 +1016,10 @@ fn test_trampoline_onion_payload_serialization() {
10161016
10171017#[ test]
10181018fn test_trampoline_onion_payload_assembly_values ( ) {
1019+ // Test that we produce Trampoline and outer onion payloads that align with our expectations
1020+ // from the Path argument. Additionally, ensure that the fee and HTLC values using the
1021+ // `create_payment_onion` method, which hides some of the Trampoline onion inner workings, match
1022+ // the values we arrive at by assembling each onion explicitly in this test
10191023 let amt_msat = 150_000_000 ;
10201024 let cur_height = 800_000 ;
10211025
@@ -1027,7 +1031,7 @@ fn test_trampoline_onion_payload_assembly_values() {
10271031 node_features: NodeFeatures :: empty( ) ,
10281032 short_channel_id: 0 ,
10291033 channel_features: ChannelFeatures :: empty( ) ,
1030- fee_msat: 3000 ,
1034+ fee_msat: 3_000 ,
10311035 cltv_expiry_delta: 24 ,
10321036 maybe_announced_channel: false ,
10331037 } ,
@@ -1144,6 +1148,21 @@ fn test_trampoline_onion_payload_assembly_values() {
11441148 } else {
11451149 panic ! ( "Bob payload must be Forward" ) ;
11461150 }
1151+
1152+ let ( _, total_msat_combined, total_htlc_offset_combined) = onion_utils:: create_payment_onion (
1153+ & Secp256k1 :: new ( ) ,
1154+ & path,
1155+ & session_priv,
1156+ amt_msat,
1157+ & recipient_onion_fields,
1158+ cur_height,
1159+ & payment_hash,
1160+ & None ,
1161+ None ,
1162+ prng_seed,
1163+ ) . unwrap ( ) ;
1164+ assert_eq ! ( total_msat_combined, total_msat) ;
1165+ assert_eq ! ( total_htlc_offset_combined, total_htlc_offset) ;
11471166}
11481167
11491168#[ test]
0 commit comments