@@ -1961,45 +1961,9 @@ pub fn test_htlc_on_chain_success() {
19611961 _ => panic ! ( "Unexpected event" ) ,
19621962 }
19631963
1964- macro_rules! check_tx_local_broadcast {
1965- ( $node: expr, $htlc_offered: expr, $commitment_tx: expr) => { {
1966- let mut node_txn = $node. tx_broadcaster. txn_broadcasted. lock( ) . unwrap( ) ;
1967- // HTLC timeout claims for non-anchor channels are only aggregated when claimed from the
1968- // remote commitment transaction.
1969- if $htlc_offered {
1970- assert_eq!( node_txn. len( ) , 2 ) ;
1971- for tx in node_txn. iter( ) {
1972- check_spends!( tx, $commitment_tx) ;
1973- assert_ne!( tx. lock_time, LockTime :: ZERO ) ;
1974- assert_eq!(
1975- tx. input[ 0 ] . witness. last( ) . unwrap( ) . len( ) ,
1976- OFFERED_HTLC_SCRIPT_WEIGHT
1977- ) ;
1978- assert!( tx. output[ 0 ] . script_pubkey. is_p2wsh( ) ) ; // revokeable output
1979- }
1980- assert_ne!(
1981- node_txn[ 0 ] . input[ 0 ] . previous_output,
1982- node_txn[ 1 ] . input[ 0 ] . previous_output
1983- ) ;
1984- } else {
1985- assert_eq!( node_txn. len( ) , 1 ) ;
1986- check_spends!( node_txn[ 0 ] , $commitment_tx) ;
1987- assert_ne!( node_txn[ 0 ] . lock_time, LockTime :: ZERO ) ;
1988- assert_eq!(
1989- node_txn[ 0 ] . input[ 0 ] . witness. last( ) . unwrap( ) . len( ) ,
1990- ACCEPTED_HTLC_SCRIPT_WEIGHT
1991- ) ;
1992- assert!( node_txn[ 0 ] . output[ 0 ] . script_pubkey. is_p2wpkh( ) ) ; // direct payment
1993- assert_ne!(
1994- node_txn[ 0 ] . input[ 0 ] . previous_output,
1995- node_txn[ 0 ] . input[ 1 ] . previous_output
1996- ) ;
1997- }
1998- node_txn. clear( ) ;
1999- } } ;
2000- }
2001- // nodes[1] now broadcasts its own timeout-claim of the output that nodes[2] just claimed via success.
2002- check_tx_local_broadcast ! ( nodes[ 1 ] , false , commitment_tx[ 0 ] ) ;
1964+ // nodes[1] does not broadcast its own timeout-claim of the output as nodes[2] just claimed it
1965+ // via success.
1966+ assert ! ( nodes[ 1 ] . tx_broadcaster. txn_broadcasted. lock( ) . unwrap( ) . is_empty( ) ) ;
20031967
20041968 // Broadcast legit commitment tx from A on B's chain
20051969 // Broadcast preimage tx by B on offered output from A commitment tx on A's chain
@@ -2061,7 +2025,17 @@ pub fn test_htlc_on_chain_success() {
20612025 _ => panic ! ( "Unexpected event" ) ,
20622026 }
20632027 }
2064- check_tx_local_broadcast ! ( nodes[ 0 ] , true , node_a_commitment_tx[ 0 ] ) ;
2028+ // HTLC timeout claims for non-anchor channels are only aggregated when claimed from the
2029+ // remote commitment transaction.
2030+ let mut node_txn = nodes[ 0 ] . tx_broadcaster . txn_broadcast ( ) ;
2031+ assert_eq ! ( node_txn. len( ) , 2 ) ;
2032+ for tx in node_txn. iter ( ) {
2033+ check_spends ! ( tx, node_a_commitment_tx[ 0 ] ) ;
2034+ assert_ne ! ( tx. lock_time, LockTime :: ZERO ) ;
2035+ assert_eq ! ( tx. input[ 0 ] . witness. last( ) . unwrap( ) . len( ) , OFFERED_HTLC_SCRIPT_WEIGHT ) ;
2036+ assert ! ( tx. output[ 0 ] . script_pubkey. is_p2wsh( ) ) ; // revokeable output
2037+ }
2038+ assert_ne ! ( node_txn[ 0 ] . input[ 0 ] . previous_output, node_txn[ 1 ] . input[ 0 ] . previous_output) ;
20652039}
20662040
20672041fn do_test_htlc_on_chain_timeout ( connect_style : ConnectStyle ) {
0 commit comments