Merge pull request #2820 from TheBlueMatt/2024-01-fuzz-ooo-monitor-updates
[rust-lightning] / fuzz / src / onion_hop_data.rs
1 // This file is Copyright its original authors, visible in version control
2 // history.
3 //
4 // This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
5 // or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
6 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
7 // You may not use this file except in accordance with one or both of these
8 // licenses.
9
10 // This file is auto-generated by gen_target.sh based on msg_target_template.txt
11 // To modify it, modify msg_target_template.txt and run gen_target.sh instead.
12
13 use crate::utils::test_logger;
14 use lightning::util::test_utils;
15
16 #[inline]
17 pub fn onion_hop_data_test<Out: test_logger::Output>(data: &[u8], _out: Out) {
18         use lightning::util::ser::ReadableArgs;
19         use bitcoin::secp256k1::PublicKey;
20         let mut r = ::std::io::Cursor::new(data);
21         let node_signer = test_utils::TestNodeSigner::new(test_utils::privkey(42));
22         let _ =  <lightning::ln::msgs::InboundOnionPayload as ReadableArgs<(Option<PublicKey>, &&test_utils::TestNodeSigner)>>::read(&mut r, (None, &&node_signer));
23 }
24
25 #[no_mangle]
26 pub extern "C" fn onion_hop_data_run(data: *const u8, datalen: usize) {
27         use lightning::util::ser::ReadableArgs;
28         use bitcoin::secp256k1::PublicKey;
29         let data = unsafe { std::slice::from_raw_parts(data, datalen) };
30         let mut r = ::std::io::Cursor::new(data);
31         let node_signer = test_utils::TestNodeSigner::new(test_utils::privkey(42));
32         let _ =  <lightning::ln::msgs::InboundOnionPayload as ReadableArgs<(Option<PublicKey>, &&test_utils::TestNodeSigner)>>::read(&mut r, (None, &&node_signer));
33 }