extern crate lightning;
extern crate secp256k1;
+use bitcoin::network::constants::Network;
+
+use lightning::chain::chaininterface;
use lightning::ln::channelmanager::ChannelDetails;
use lightning::ln::msgs;
use lightning::ln::msgs::{MsgDecodable, RoutingMessageHandler};
Ok(msg) => msg,
Err(e) => match e {
msgs::DecodeError::UnknownRealmByte => return,
+ msgs::DecodeError::UnknownRequiredFeature => return,
msgs::DecodeError::BadPublicKey => return,
msgs::DecodeError::BadSignature => return,
msgs::DecodeError::BadText => return,
}
}
- let logger: Arc<Logger> = Arc::new(test_logger::TestLogger::new());
+ let logger: Arc<Logger> = Arc::new(test_logger::TestLogger{});
+ let chain_monitor = Arc::new(chaininterface::ChainWatchInterfaceUtil::new(Network::Bitcoin, Arc::clone(&logger)));
let our_pubkey = get_pubkey!();
- let router = Router::new(our_pubkey.clone(), Arc::clone(&logger));
+ let router = Router::new(our_pubkey.clone(), chain_monitor, Arc::clone(&logger));
loop {
match get_slice!(1)[0] {
last_hops_vec.push(RouteHint {
src_node_id: get_pubkey!(),
short_channel_id: slice_to_be64(get_slice!(8)),
- fee_base_msat: slice_to_be64(get_slice!(8)),
+ fee_base_msat: slice_to_be32(get_slice!(4)),
fee_proportional_millionths: slice_to_be32(get_slice!(4)),
cltv_expiry_delta: slice_to_be16(get_slice!(2)),
htlc_minimum_msat: slice_to_be64(get_slice!(8)),
}
#[cfg(feature = "afl")]
-extern crate afl;
+#[macro_use] extern crate afl;
#[cfg(feature = "afl")]
fn main() {
- afl::read_stdio_bytes(|data| {
- do_test(&data);
+ fuzz!(|data| {
+ do_test(data);
});
}