@@ -1016,6 +1016,10 @@ fn test_trampoline_onion_payload_serialization() {
1016
1016
1017
1017
#[ test]
1018
1018
fn 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
1019
1023
let amt_msat = 150_000_000 ;
1020
1024
let cur_height = 800_000 ;
1021
1025
@@ -1027,7 +1031,7 @@ fn test_trampoline_onion_payload_assembly_values() {
1027
1031
node_features: NodeFeatures :: empty( ) ,
1028
1032
short_channel_id: 0 ,
1029
1033
channel_features: ChannelFeatures :: empty( ) ,
1030
- fee_msat: 3000 ,
1034
+ fee_msat: 3_000 ,
1031
1035
cltv_expiry_delta: 24 ,
1032
1036
maybe_announced_channel: false ,
1033
1037
} ,
@@ -1144,6 +1148,21 @@ fn test_trampoline_onion_payload_assembly_values() {
1144
1148
} else {
1145
1149
panic ! ( "Bob payload must be Forward" ) ;
1146
1150
}
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) ;
1147
1166
}
1148
1167
1149
1168
#[ test]
0 commit comments