+ let chan_update = ChannelUpdate::dummy(short_channel_id);
+
+ let mut err_data = Vec::new();
+ err_data.extend_from_slice(&(chan_update.serialized_length() as u16 + 2).to_be_bytes());
+ err_data.extend_from_slice(&ChannelUpdate::TYPE.to_be_bytes());
+ err_data.extend_from_slice(&chan_update.encode());
+ run_onion_failure_test_with_fail_intercept("temporary_channel_failure", 100, &nodes, &route, &payment_hash, &payment_secret, |msg| {
+ msg.amount_msat -= 1;
+ }, |msg| {
+ let session_priv = SecretKey::from_slice(&[3; 32]).unwrap();
+ let onion_keys = onion_utils::construct_onion_keys(&Secp256k1::new(), &route.paths[0], &session_priv).unwrap();
+ msg.reason = onion_utils::build_first_hop_failure_packet(onion_keys[0].shared_secret.as_ref(), UPDATE|7, &err_data);
+ }, ||{}, true, Some(UPDATE|7), Some(NetworkUpdate::ChannelUpdateMessage{msg: chan_update.clone()}), Some(short_channel_id));
+
+ // Check we can still handle onion failures that include channel updates without a type prefix
+ let err_data_without_type = chan_update.encode_with_len();