@@ -403,14 +403,15 @@ pub fn create_announced_chan_between_nodes_with_value<'a, 'b, 'c, 'd>(nodes: &'a
403
403
}
404
404
405
405
macro_rules! check_spends {
406
- ( $tx: expr, $spends_tx : expr) => {
406
+ ( $tx: expr, $( $spends_txn : expr) , * ) => {
407
407
{
408
408
$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
414
415
} ) . unwrap( ) ;
415
416
}
416
417
}
@@ -1033,7 +1034,7 @@ pub fn test_txn_broadcast<'a, 'b, 'c>(node: &Node<'a, 'b, 'c>, chan: &(msgs::Cha
1033
1034
let mut res = Vec :: with_capacity ( 2 ) ;
1034
1035
node_txn. retain ( |tx| {
1035
1036
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 ) ;
1037
1038
if commitment_tx. is_none ( ) {
1038
1039
res. push ( tx. clone ( ) ) ;
1039
1040
}
@@ -1049,7 +1050,7 @@ pub fn test_txn_broadcast<'a, 'b, 'c>(node: &Node<'a, 'b, 'c>, chan: &(msgs::Cha
1049
1050
if has_htlc_tx != HTLCType :: NONE {
1050
1051
node_txn. retain ( |tx| {
1051
1052
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 ] ) ;
1053
1054
if has_htlc_tx == HTLCType :: TIMEOUT {
1054
1055
assert ! ( tx. lock_time != 0 ) ;
1055
1056
} else {
@@ -1098,7 +1099,7 @@ pub fn check_preimage_claim<'a, 'b, 'c>(node: &Node<'a, 'b, 'c>, prev_txn: &Vec<
1098
1099
1099
1100
for tx in prev_txn {
1100
1101
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) ;
1102
1103
assert ! ( node_txn[ 0 ] . input[ 0 ] . witness[ 2 ] . len( ) > 106 ) ; // must spend an htlc output
1103
1104
assert_eq ! ( tx. input. len( ) , 1 ) ; // must spend a commitment tx
1104
1105
0 commit comments