use lightning::routing::network_graph::{NetworkGraph, RoutingFees};
use bitcoin::secp256k1::key::PublicKey;
use lightning::routing::network_graph::{NetworkGraph, RoutingFees};
use bitcoin::secp256k1::key::PublicKey;
($MsgType: path, $len: expr) => {{
let mut reader = ::std::io::Cursor::new(get_slice!($len));
match <$MsgType>::read(&mut reader) {
($MsgType: path, $len: expr) => {{
let mut reader = ::std::io::Cursor::new(get_slice!($len));
match <$MsgType>::read(&mut reader) {
Err(e) => match e {
msgs::DecodeError::UnknownVersion => return,
msgs::DecodeError::UnknownRequiredFeature => return,
msgs::DecodeError::InvalidValue => return,
msgs::DecodeError::BadLengthDescriptor => return,
msgs::DecodeError::ShortRead => panic!("We picked the length..."),
Err(e) => match e {
msgs::DecodeError::UnknownVersion => return,
msgs::DecodeError::UnknownRequiredFeature => return,
msgs::DecodeError::InvalidValue => return,
msgs::DecodeError::BadLengthDescriptor => return,
msgs::DecodeError::ShortRead => panic!("We picked the length..."),
- let extra_len = slice_to_be16(&get_slice_nonadvancing!($begin_len as usize + 2)[$begin_len..$begin_len + 2]);
- decode_msg!($MsgType, $begin_len as usize + 2 + (extra_len as usize) + $excess)
+ let extra_len = slice_to_be16(get_slice_nonadvancing!(2));
+ decode_msg!($MsgType, 2 + (extra_len as usize) + $excess)
let logger: Arc<dyn Logger> = Arc::new(test_logger::TestLogger::new("".to_owned(), out));
let our_pubkey = get_pubkey!();
let logger: Arc<dyn Logger> = Arc::new(test_logger::TestLogger::new("".to_owned(), out));
let our_pubkey = get_pubkey!();
- let start_len = slice_to_be16(&get_slice_nonadvancing!(64 + 2)[64..64 + 2]) as usize;
- let addr_len = slice_to_be16(&get_slice_nonadvancing!(64+start_len+2 + 74)[64+start_len+2 + 72..64+start_len+2 + 74]);
+ let start_len = slice_to_be16(&get_slice_nonadvancing!(2)[0..2]) as usize;
+ let addr_len = slice_to_be16(&get_slice_nonadvancing!(start_len+2 + 74)[start_len+2 + 72..start_len+2 + 74]);
- let msg = decode_msg_with_len16!(msgs::NodeAnnouncement, 64, 288);
- node_pks.insert(msg.contents.node_id);
- let _ = net_graph.update_node_from_announcement::<secp256k1::VerifyOnly>(&msg, None);
+ let msg = decode_msg_with_len16!(msgs::UnsignedNodeAnnouncement, 288);
+ node_pks.insert(msg.node_id);
+ let _ = net_graph.update_node_from_unsigned_announcement(&msg);
- let msg = decode_msg_with_len16!(msgs::ChannelAnnouncement, 64*4, 32+8+33*4);
- node_pks.insert(msg.contents.node_id_1);
- node_pks.insert(msg.contents.node_id_2);
- let _ = net_graph.update_channel_from_announcement::<secp256k1::VerifyOnly, &FuzzChainSource>(&msg, &None, None);
+ let msg = decode_msg_with_len16!(msgs::UnsignedChannelAnnouncement, 32+8+33*4);
+ node_pks.insert(msg.node_id_1);
+ node_pks.insert(msg.node_id_2);
+ let _ = net_graph.update_channel_from_unsigned_announcement::<&FuzzChainSource>(&msg, &None);
- let msg = decode_msg_with_len16!(msgs::ChannelAnnouncement, 64*4, 32+8+33*4);
- node_pks.insert(msg.contents.node_id_1);
- node_pks.insert(msg.contents.node_id_2);
- let _ = net_graph.update_channel_from_announcement::<secp256k1::VerifyOnly, &FuzzChainSource>(&msg, &Some(&FuzzChainSource { input: Arc::clone(&input) }), None);
+ let msg = decode_msg_with_len16!(msgs::UnsignedChannelAnnouncement, 32+8+33*4);
+ node_pks.insert(msg.node_id_1);
+ node_pks.insert(msg.node_id_2);
+ let _ = net_graph.update_channel_from_unsigned_announcement(&msg, &Some(&FuzzChainSource { input: Arc::clone(&input) }));