- const BADONION: u16 = 0x8000;
- const PERM: u16 = 0x4000;
- const NODE: u16 = 0x2000;
- const UPDATE: u16 = 0x1000;
+ // positive case
+ let (route, payment_hash_success, payment_preimage_success, payment_secret_success) = get_route_and_payment_hash!(nodes[0], nodes[2], 40_000);
+ nodes[0].node.send_payment(&route, payment_hash_success, &Some(payment_secret_success)).unwrap();
+ check_added_monitors!(nodes[0], 1);
+ pass_along_route(&nodes[0], &[&[&nodes[1], &nodes[2]]], 40_000, payment_hash_success, payment_secret_success);
+ claim_payment(&nodes[0], &[&nodes[1], &nodes[2]], payment_preimage_success);
+
+ // If the hop gives fee_insufficient but enough fees were provided, then the previous hop
+ // malleated the payment before forwarding, taking funds when they shouldn't have.
+ let (_, payment_hash, payment_secret) = get_payment_preimage_hash!(nodes[2]);
+ let short_channel_id = channels[0].0.contents.short_channel_id;
+ run_onion_failure_test("fee_insufficient", 0, &nodes, &route, &payment_hash, &payment_secret, |msg| {
+ msg.amount_msat -= 1;
+ }, || {}, true, Some(UPDATE|12), Some(NetworkUpdate::ChannelClosed { short_channel_id, is_permanent: true}), Some(short_channel_id));