]> git.bitcoin.ninja Git - rust-lightning/blob - lightning/src/util/fuzz_wrappers.rs
Merge pull request #1861 from TheBlueMatt/2022-11-tx-connection-idempotency
[rust-lightning] / lightning / src / util / fuzz_wrappers.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 macro_rules! hash_to_message {
11         ($slice: expr) => {
12                 {
13                         #[cfg(not(fuzzing))]
14                         {
15                                 ::bitcoin::secp256k1::Message::from_slice($slice).unwrap()
16                         }
17                         #[cfg(fuzzing)]
18                         {
19                                 match ::bitcoin::secp256k1::Message::from_slice($slice) {
20                                         Ok(msg) => msg,
21                                         Err(_) => ::bitcoin::secp256k1::Message::from_slice(&[1; 32]).unwrap()
22                                 }
23                         }
24                 }
25         }
26 }