WIP
[rust-lightning] / lightning / src / ln / functional_test_utils.rs
index d21dc792185b0eeb2f1899b3e35fb95e3b98476c..890ce010a292a12d11e99eb3a2f58a77881696c9 100644 (file)
@@ -475,25 +475,14 @@ pub fn create_announced_chan_between_nodes_with_value<'a, 'b, 'c, 'd>(nodes: &'a
 macro_rules! check_spends {
        ($tx: expr, $($spends_txn: expr),*) => {
                {
-                       let get_output = |out_point: &bitcoin::blockdata::transaction::OutPoint| {
+                       $tx.verify(|out_point| {
                                $(
                                        if out_point.txid == $spends_txn.txid() {
                                                return $spends_txn.output.get(out_point.vout as usize).cloned()
                                        }
                                )*
                                None
-                       };
-                       let mut total_value_in = 0;
-                       for input in $tx.input.iter() {
-                               total_value_in += get_output(&input.previous_output).unwrap().value;
-                       }
-                       let mut total_value_out = 0;
-                       for output in $tx.output.iter() {
-                               total_value_out += output.value;
-                       }
-                       let min_fee = $tx.get_weight() as u64 / 4; // One sat per vbyte
-                       assert!(total_value_out + min_fee <= total_value_in); // Must not be equal as there must be a fee!
-                       $tx.verify(get_output).unwrap();
+                       }).unwrap();
                }
        }
 }
@@ -1130,8 +1119,8 @@ pub fn create_network<'a, 'b: 'a, 'c: 'b>(node_count: usize, cfgs: &'b Vec<NodeC
        nodes
 }
 
-pub const ACCEPTED_HTLC_SCRIPT_WEIGHT: usize = 138; //Here we have a diff due to HTLC CLTV expiry being < 2^15 in test
-pub const OFFERED_HTLC_SCRIPT_WEIGHT: usize = 133;
+pub const ACCEPTED_HTLC_SCRIPT_WEIGHT: usize = 141; //Here we have a diff due to HTLC CLTV expiry being < 2^15 in test
+pub const OFFERED_HTLC_SCRIPT_WEIGHT: usize = 136;
 
 #[derive(PartialEq)]
 pub enum HTLCType { NONE, TIMEOUT, SUCCESS }