echo "pub mod $tn;" >> mod.rs
}
-echo "mod utils;" > mod.rs
+{
+ echo "#![cfg_attr(rustfmt, rustfmt_skip)]"
+ echo "mod utils;"
+} > mod.rs
# Note when adding new targets here you should add a similar line in src/bin/gen_target.sh
+#![cfg_attr(rustfmt, rustfmt_skip)]
mod utils;
pub mod msg_accept_channel;
pub mod msg_announcement_signatures;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// This file is auto-generated by gen_target.sh based on msg_target_template.txt
// To modify it, modify msg_target_template.txt and run gen_target.sh instead.
+#![cfg_attr(rustfmt, rustfmt_skip)]
+
use crate::msg_targets::utils::VecWriter;
use crate::utils::test_logger;
// entirely
#[macro_export]
macro_rules! test_msg {
- ($MsgType: path, $data: ident) => {
- {
- use lightning::util::ser::{Writeable, Readable};
- let mut r = ::std::io::Cursor::new($data);
- if let Ok(msg) = <$MsgType as Readable>::read(&mut r) {
- let p = r.position() as usize;
- let mut w = VecWriter(Vec::new());
- msg.write(&mut w).unwrap();
+ ($MsgType: path, $data: ident) => {{
+ use lightning::util::ser::{Readable, Writeable};
+ let mut r = ::std::io::Cursor::new($data);
+ if let Ok(msg) = <$MsgType as Readable>::read(&mut r) {
+ let p = r.position() as usize;
+ let mut w = VecWriter(Vec::new());
+ msg.write(&mut w).unwrap();
- assert_eq!(w.0.len(), p);
- assert_eq!(msg.serialized_length(), p);
- assert_eq!(&r.into_inner()[..p], &w.0[..p]);
- }
+ assert_eq!(w.0.len(), p);
+ assert_eq!(msg.serialized_length(), p);
+ assert_eq!(&r.into_inner()[..p], &w.0[..p]);
}
- }
+ }};
}
// Tests a message that may lose data on roundtrip, but shoulnd't lose data compared to our
// re-serialization.
#[macro_export]
macro_rules! test_msg_simple {
- ($MsgType: path, $data: ident) => {
- {
- use lightning::util::ser::{Writeable, Readable};
- let mut r = ::std::io::Cursor::new($data);
- if let Ok(msg) = <$MsgType as Readable>::read(&mut r) {
- let mut w = VecWriter(Vec::new());
- msg.write(&mut w).unwrap();
- assert_eq!(msg.serialized_length(), w.0.len());
+ ($MsgType: path, $data: ident) => {{
+ use lightning::util::ser::{Readable, Writeable};
+ let mut r = ::std::io::Cursor::new($data);
+ if let Ok(msg) = <$MsgType as Readable>::read(&mut r) {
+ let mut w = VecWriter(Vec::new());
+ msg.write(&mut w).unwrap();
+ assert_eq!(msg.serialized_length(), w.0.len());
- let msg = <$MsgType as Readable>::read(&mut ::std::io::Cursor::new(&w.0)).unwrap();
- let mut w_two = VecWriter(Vec::new());
- msg.write(&mut w_two).unwrap();
- assert_eq!(&w.0[..], &w_two.0[..]);
- }
+ let msg = <$MsgType as Readable>::read(&mut ::std::io::Cursor::new(&w.0)).unwrap();
+ let mut w_two = VecWriter(Vec::new());
+ msg.write(&mut w_two).unwrap();
+ assert_eq!(&w.0[..], &w_two.0[..]);
}
- }
+ }};
}
// Tests a message that must survive roundtrip exactly, and must exactly empty the read buffer and
// split it back out on re-serialization.
#[macro_export]
macro_rules! test_msg_exact {
- ($MsgType: path, $data: ident) => {
- {
- use lightning::util::ser::{Writeable, Readable};
- let mut r = ::std::io::Cursor::new($data);
- if let Ok(msg) = <$MsgType as Readable>::read(&mut r) {
- let mut w = VecWriter(Vec::new());
- msg.write(&mut w).unwrap();
- assert_eq!(&r.into_inner()[..], &w.0[..]);
- assert_eq!(msg.serialized_length(), w.0.len());
- }
+ ($MsgType: path, $data: ident) => {{
+ use lightning::util::ser::{Readable, Writeable};
+ let mut r = ::std::io::Cursor::new($data);
+ if let Ok(msg) = <$MsgType as Readable>::read(&mut r) {
+ let mut w = VecWriter(Vec::new());
+ msg.write(&mut w).unwrap();
+ assert_eq!(&r.into_inner()[..], &w.0[..]);
+ assert_eq!(msg.serialized_length(), w.0.len());
}
- }
+ }};
}
// Tests a message that must survive roundtrip exactly, modulo one "hole" which may be set to
// any value on re-serialization.
#[macro_export]
macro_rules! test_msg_hole {
- ($MsgType: path, $data: ident, $hole: expr, $hole_len: expr) => {
- {
- use lightning::util::ser::{Writeable, Readable};
- let mut r = ::std::io::Cursor::new($data);
- if let Ok(msg) = <$MsgType as Readable>::read(&mut r) {
- let mut w = VecWriter(Vec::new());
- msg.write(&mut w).unwrap();
- let p = w.0.len() as usize;
- assert_eq!(msg.serialized_length(), p);
+ ($MsgType: path, $data: ident, $hole: expr, $hole_len: expr) => {{
+ use lightning::util::ser::{Readable, Writeable};
+ let mut r = ::std::io::Cursor::new($data);
+ if let Ok(msg) = <$MsgType as Readable>::read(&mut r) {
+ let mut w = VecWriter(Vec::new());
+ msg.write(&mut w).unwrap();
+ let p = w.0.len() as usize;
+ assert_eq!(msg.serialized_length(), p);
- assert_eq!(w.0.len(), p);
- assert_eq!(&r.get_ref()[..$hole], &w.0[..$hole]);
- assert_eq!(&r.get_ref()[$hole+$hole_len..p], &w.0[$hole+$hole_len..]);
- }
+ assert_eq!(w.0.len(), p);
+ assert_eq!(&r.get_ref()[..$hole], &w.0[..$hole]);
+ assert_eq!(&r.get_ref()[$hole + $hole_len..p], &w.0[$hole + $hole_len..]);
}
- }
+ }};
}
./bench/benches/bench.rs
./fuzz/src/chanmon_consistency.rs
./fuzz/src/full_stack.rs
-./fuzz/src/msg_targets/mod.rs
-./fuzz/src/msg_targets/msg_accept_channel.rs
-./fuzz/src/msg_targets/msg_accept_channel_v2.rs
-./fuzz/src/msg_targets/msg_announcement_signatures.rs
-./fuzz/src/msg_targets/msg_channel_announcement.rs
-./fuzz/src/msg_targets/msg_channel_details.rs
-./fuzz/src/msg_targets/msg_channel_ready.rs
-./fuzz/src/msg_targets/msg_channel_reestablish.rs
-./fuzz/src/msg_targets/msg_channel_update.rs
-./fuzz/src/msg_targets/msg_closing_signed.rs
-./fuzz/src/msg_targets/msg_commitment_signed.rs
-./fuzz/src/msg_targets/msg_decoded_onion_error_packet.rs
-./fuzz/src/msg_targets/msg_error_message.rs
-./fuzz/src/msg_targets/msg_funding_created.rs
-./fuzz/src/msg_targets/msg_funding_signed.rs
-./fuzz/src/msg_targets/msg_gossip_timestamp_filter.rs
-./fuzz/src/msg_targets/msg_init.rs
-./fuzz/src/msg_targets/msg_node_announcement.rs
-./fuzz/src/msg_targets/msg_open_channel.rs
-./fuzz/src/msg_targets/msg_open_channel_v2.rs
-./fuzz/src/msg_targets/msg_ping.rs
-./fuzz/src/msg_targets/msg_pong.rs
-./fuzz/src/msg_targets/msg_query_channel_range.rs
-./fuzz/src/msg_targets/msg_query_short_channel_ids.rs
-./fuzz/src/msg_targets/msg_reply_channel_range.rs
-./fuzz/src/msg_targets/msg_reply_short_channel_ids_end.rs
-./fuzz/src/msg_targets/msg_revoke_and_ack.rs
-./fuzz/src/msg_targets/msg_shutdown.rs
-./fuzz/src/msg_targets/msg_splice.rs
-./fuzz/src/msg_targets/msg_splice_ack.rs
-./fuzz/src/msg_targets/msg_splice_locked.rs
-./fuzz/src/msg_targets/msg_stfu.rs
-./fuzz/src/msg_targets/msg_tx_abort.rs
-./fuzz/src/msg_targets/msg_tx_ack_rbf.rs
-./fuzz/src/msg_targets/msg_tx_add_input.rs
-./fuzz/src/msg_targets/msg_tx_add_output.rs
-./fuzz/src/msg_targets/msg_tx_complete.rs
-./fuzz/src/msg_targets/msg_tx_init_rbf.rs
-./fuzz/src/msg_targets/msg_tx_remove_input.rs
-./fuzz/src/msg_targets/msg_tx_remove_output.rs
-./fuzz/src/msg_targets/msg_tx_signatures.rs
-./fuzz/src/msg_targets/msg_update_add_htlc.rs
-./fuzz/src/msg_targets/msg_update_fail_htlc.rs
-./fuzz/src/msg_targets/msg_update_fail_malformed_htlc.rs
-./fuzz/src/msg_targets/msg_update_fee.rs
-./fuzz/src/msg_targets/msg_update_fulfill_htlc.rs
-./fuzz/src/msg_targets/msg_warning_message.rs
-./fuzz/src/msg_targets/utils.rs
./fuzz/src/offer_deser.rs
./fuzz/src/onion_hop_data.rs
./fuzz/src/onion_message.rs