Merge pull request #386 from TheBlueMatt/2019-10-useless-lints
[rust-lightning] / src / ln / functional_test_utils.rs
index 001da7009b8a67e05ff22ae9719da7ce869434b9..3c84cff5b1a418e13c1896d888361fd742d81e2e 100644 (file)
@@ -29,8 +29,6 @@ use secp256k1::key::PublicKey;
 use rand::{thread_rng,Rng};
 
 use std::cell::RefCell;
-use std::collections::HashMap;
-use std::default::Default;
 use std::rc::Rc;
 use std::sync::{Arc, Mutex};
 use std::mem;
@@ -307,10 +305,13 @@ pub fn create_announced_chan_between_nodes_with_value(nodes: &Vec<Node>, a: usiz
 macro_rules! check_spends {
        ($tx: expr, $spends_tx: expr) => {
                {
-                       let mut funding_tx_map = HashMap::new();
-                       let spends_tx = $spends_tx;
-                       funding_tx_map.insert(spends_tx.txid(), spends_tx);
-                       $tx.verify(&funding_tx_map).unwrap();
+                       $tx.verify(|out_point| {
+                               if out_point.txid == $spends_tx.txid() {
+                                       $spends_tx.output.get(out_point.vout as usize).cloned()
+                               } else {
+                                       None
+                               }
+                       }).unwrap();
                }
        }
 }
@@ -740,7 +741,7 @@ pub fn route_over_limit(origin_node: &Node, expected_route: &[&Node], recv_value
 
        let err = origin_node.node.send_payment(route, our_payment_hash).err().unwrap();
        match err {
-               APIError::ChannelUnavailable{err} => assert_eq!(err, "Cannot send value that would put us over the max HTLC value in flight"),
+               APIError::ChannelUnavailable{err} => assert_eq!(err, "Cannot send value that would put us over the max HTLC value in flight our peer will accept"),
                _ => panic!("Unknown error variants"),
        };
 }