]> git.bitcoin.ninja Git - rust-lightning/blobdiff - fuzz/src/full_stack.rs
Relicense as dual Apache-2.0 + MIT
[rust-lightning] / fuzz / src / full_stack.rs
index 8cef7fb5458f0f0105cd655e78f2b6e0f4621d4f..51e399412cb140562002277ab4653739a12f3427 100644 (file)
@@ -1,3 +1,12 @@
+// This file is Copyright its original authors, visible in version control
+// history.
+//
+// This file is licensed under the Apache License, Version 2.0 <LICENSE-APACHE
+// or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
+// You may not use this file except in accordance with one or both of these
+// licenses.
+
 //! Test that no series of bytes received over the wire/connections created/payments sent can
 //! result in a crash. We do this by standing up a node and then reading bytes from input to denote
 //! actions such as creating new inbound/outbound connections, bytes to be read from a connection,
@@ -94,10 +103,10 @@ struct FuzzEstimator {
        input: Arc<InputData>,
 }
 impl FeeEstimator for FuzzEstimator {
-       fn get_est_sat_per_1000_weight(&self, _: ConfirmationTarget) -> u64 {
+       fn get_est_sat_per_1000_weight(&self, _: ConfirmationTarget) -> u32 {
                //TODO: We should actually be testing at least much more than 64k...
                match self.input.get_slice(2) {
-                       Some(slice) => cmp::max(slice_to_be16(slice) as u64, 253),
+                       Some(slice) => cmp::max(slice_to_be16(slice) as u32, 253),
                        None => 253
                }
        }
@@ -183,7 +192,7 @@ impl<'a> MoneyLossDetector<'a> {
                                hash_map::Entry::Vacant(e) => {
                                        e.insert(self.height);
                                        txn.push(tx);
-                                       txn_idxs.push(idx as u32 + 1);
+                                       txn_idxs.push(idx + 1);
                                },
                                _ => {},
                        }
@@ -400,7 +409,7 @@ pub fn do_test(data: &[u8], logger: &Arc<dyn Logger>) {
                        },
                        4 => {
                                let value = slice_to_be24(get_slice!(3)) as u64;
-                               let route = match get_route(&our_id, &net_graph_msg_handler, &get_pubkey!(), None, &Vec::new(), value, 42, Arc::clone(&logger)) {
+                               let route = match get_route(&our_id, &net_graph_msg_handler.network_graph.read().unwrap(), &get_pubkey!(), None, &Vec::new(), value, 42, Arc::clone(&logger)) {
                                        Ok(route) => route,
                                        Err(_) => return,
                                };
@@ -417,7 +426,7 @@ pub fn do_test(data: &[u8], logger: &Arc<dyn Logger>) {
                        },
                        15 => {
                                let value = slice_to_be24(get_slice!(3)) as u64;
-                               let mut route = match get_route(&our_id, &net_graph_msg_handler, &get_pubkey!(), None, &Vec::new(), value, 42, Arc::clone(&logger)) {
+                               let mut route = match get_route(&our_id, &net_graph_msg_handler.network_graph.read().unwrap(), &get_pubkey!(), None, &Vec::new(), value, 42, Arc::clone(&logger)) {
                                        Ok(route) => route,
                                        Err(_) => return,
                                };