Expand expect_payment_failed!() to take error codes and use it more
[rust-lightning] / fuzz / src / router.rs
index 99013d87e6e8bc97d710799bcbe1199ae7a85c6c..b1a766ba79149b5640a080c55a625eb338424a03 100644 (file)
@@ -5,8 +5,9 @@ use bitcoin::blockdata::transaction::Transaction;
 
 use lightning::chain::chaininterface::{ChainError,ChainWatchInterface};
 use lightning::ln::channelmanager::ChannelDetails;
+use lightning::ln::features::InitFeatures;
 use lightning::ln::msgs;
-use lightning::ln::msgs::{RoutingMessageHandler};
+use lightning::ln::msgs::RoutingMessageHandler;
 use lightning::ln::router::{Router, RouteHint};
 use lightning::util::logger::Logger;
 use lightning::util::ser::Readable;
@@ -117,13 +118,12 @@ pub fn do_test(data: &[u8]) {
        macro_rules! decode_msg {
                ($MsgType: path, $len: expr) => {{
                        let mut reader = ::std::io::Cursor::new(get_slice!($len));
-                       match <($MsgType)>::read(&mut reader) {
+                       match <$MsgType>::read(&mut reader) {
                                Ok(msg) => msg,
                                Err(e) => match e {
                                        msgs::DecodeError::UnknownVersion => return,
                                        msgs::DecodeError::UnknownRequiredFeature => return,
                                        msgs::DecodeError::InvalidValue => return,
-                                       msgs::DecodeError::ExtraAddressesPerType => return,
                                        msgs::DecodeError::BadLengthDescriptor => return,
                                        msgs::DecodeError::ShortRead => panic!("We picked the length..."),
                                        msgs::DecodeError::Io(e) => panic!(format!("{}", e)),
@@ -198,6 +198,7 @@ pub fn do_test(data: &[u8]) {
                                                                channel_id: [0; 32],
                                                                short_channel_id: Some(slice_to_be64(get_slice!(8))),
                                                                remote_network_id: get_pubkey!(),
+                                                               counterparty_features: InitFeatures::empty(),
                                                                channel_value_satoshis: slice_to_be64(get_slice!(8)),
                                                                user_id: 0,
                                                                inbound_capacity_msat: 0,