@@ -403,14 +403,15 @@ pub fn create_announced_chan_between_nodes_with_value<'a, 'b, 'c, 'd>(nodes: &'a
403403}
404404
405405macro_rules! check_spends {
406- ( $tx: expr, $spends_tx : expr) => {
406+ ( $tx: expr, $( $spends_txn : expr) , * ) => {
407407 {
408408 $tx. verify( |out_point| {
409- if out_point. txid == $spends_tx. txid( ) {
410- $spends_tx. output. get( out_point. vout as usize ) . cloned( )
411- } else {
412- None
413- }
409+ $(
410+ if out_point. txid == $spends_txn. txid( ) {
411+ return $spends_txn. output. get( out_point. vout as usize ) . cloned( )
412+ }
413+ ) *
414+ None
414415 } ) . unwrap( ) ;
415416 }
416417 }
@@ -1033,7 +1034,7 @@ pub fn test_txn_broadcast<'a, 'b, 'c>(node: &Node<'a, 'b, 'c>, chan: &(msgs::Cha
10331034 let mut res = Vec :: with_capacity ( 2 ) ;
10341035 node_txn. retain ( |tx| {
10351036 if tx. input . len ( ) == 1 && tx. input [ 0 ] . previous_output . txid == chan. 3 . txid ( ) {
1036- check_spends ! ( tx, chan. 3 . clone ( ) ) ;
1037+ check_spends ! ( tx, chan. 3 ) ;
10371038 if commitment_tx. is_none ( ) {
10381039 res. push ( tx. clone ( ) ) ;
10391040 }
@@ -1049,7 +1050,7 @@ pub fn test_txn_broadcast<'a, 'b, 'c>(node: &Node<'a, 'b, 'c>, chan: &(msgs::Cha
10491050 if has_htlc_tx != HTLCType :: NONE {
10501051 node_txn. retain ( |tx| {
10511052 if tx. input . len ( ) == 1 && tx. input [ 0 ] . previous_output . txid == res[ 0 ] . txid ( ) {
1052- check_spends ! ( tx, res[ 0 ] . clone ( ) ) ;
1053+ check_spends ! ( tx, res[ 0 ] ) ;
10531054 if has_htlc_tx == HTLCType :: TIMEOUT {
10541055 assert ! ( tx. lock_time != 0 ) ;
10551056 } else {
@@ -1098,7 +1099,7 @@ pub fn check_preimage_claim<'a, 'b, 'c>(node: &Node<'a, 'b, 'c>, prev_txn: &Vec<
10981099
10991100 for tx in prev_txn {
11001101 if node_txn[ 0 ] . input [ 0 ] . previous_output . txid == tx. txid ( ) {
1101- check_spends ! ( node_txn[ 0 ] , tx. clone ( ) ) ;
1102+ check_spends ! ( node_txn[ 0 ] , tx) ;
11021103 assert ! ( node_txn[ 0 ] . input[ 0 ] . witness[ 2 ] . len( ) > 106 ) ; // must spend an htlc output
11031104 assert_eq ! ( tx. input. len( ) , 1 ) ; // must spend a commitment tx
11041105
0 commit comments