@@ -2360,16 +2360,9 @@ fn claim_htlc_outputs_single_tx() {
23602360 assert_eq ! ( node_txn[ 2 ] . input. len( ) , 1 ) ;
23612361 assert_eq ! ( node_txn[ 3 ] . input. len( ) , 1 ) ;
23622362 assert_eq ! ( node_txn[ 4 ] . input. len( ) , 1 ) ;
2363- fn get_txout ( out_point : & BitcoinOutPoint , tx : & Transaction ) -> Option < TxOut > {
2364- if out_point. txid == tx. txid ( ) {
2365- tx. output . get ( out_point. vout as usize ) . cloned ( )
2366- } else {
2367- None
2368- }
2369- }
2370- node_txn[ 2 ] . verify ( |out|get_txout ( out, & revoked_local_txn[ 0 ] ) ) . unwrap ( ) ;
2371- node_txn[ 3 ] . verify ( |out|get_txout ( out, & revoked_local_txn[ 0 ] ) ) . unwrap ( ) ;
2372- node_txn[ 4 ] . verify ( |out|get_txout ( out, & revoked_local_txn[ 0 ] ) ) . unwrap ( ) ;
2363+ check_spends ! ( node_txn[ 2 ] , revoked_local_txn[ 0 ] ) ;
2364+ check_spends ! ( node_txn[ 3 ] , revoked_local_txn[ 0 ] ) ;
2365+ check_spends ! ( node_txn[ 4 ] , revoked_local_txn[ 0 ] ) ;
23732366
23742367 let mut witness_lens = BTreeSet :: new ( ) ;
23752368 witness_lens. insert ( node_txn[ 2 ] . input [ 0 ] . witness . last ( ) . unwrap ( ) . len ( ) ) ;
@@ -6924,13 +6917,7 @@ fn test_bump_penalty_txn_on_revoked_htlcs() {
69246917 // Verify claim tx are spending revoked HTLC txn
69256918 assert_eq ! ( node_txn[ 4 ] . input. len( ) , 2 ) ;
69266919 assert_eq ! ( node_txn[ 4 ] . output. len( ) , 1 ) ;
6927- if node_txn[ 4 ] . input [ 0 ] . previous_output . txid == revoked_htlc_txn[ 0 ] . txid ( ) {
6928- assert_eq ! ( node_txn[ 4 ] . input[ 1 ] . previous_output. txid, revoked_htlc_txn[ 1 ] . txid( ) ) ;
6929- } else if node_txn[ 4 ] . input [ 0 ] . previous_output . txid == revoked_htlc_txn[ 1 ] . txid ( ) {
6930- assert_eq ! ( node_txn[ 4 ] . input[ 1 ] . previous_output. txid, revoked_htlc_txn[ 0 ] . txid( ) ) ;
6931- } else {
6932- panic ! ( ) ;
6933- }
6920+ check_spends ! ( node_txn[ 4 ] , revoked_htlc_txn[ 0 ] , revoked_htlc_txn[ 1 ] ) ;
69346921 first = node_txn[ 4 ] . txid ( ) ;
69356922 // Store both feerates for later comparison
69366923 let fee_1 = revoked_htlc_txn[ 0 ] . output [ 0 ] . value + revoked_htlc_txn[ 1 ] . output [ 0 ] . value - node_txn[ 4 ] . output [ 0 ] . value ;
@@ -6954,24 +6941,14 @@ fn test_bump_penalty_txn_on_revoked_htlcs() {
69546941
69556942 // Few more blocks to confirm penalty txn
69566943 let header_135 = connect_blocks ( & nodes[ 0 ] . block_notifier , 5 , 130 , true , header_130. bitcoin_hash ( ) ) ;
6957- {
6958- let mut node_txn = nodes[ 0 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) ;
6959- assert_eq ! ( node_txn. len( ) , 0 ) ;
6960- node_txn. clear ( ) ;
6961- }
6944+ assert ! ( nodes[ 0 ] . tx_broadcaster. txn_broadcasted. lock( ) . unwrap( ) . is_empty( ) ) ;
69626945 let header_144 = connect_blocks ( & nodes[ 0 ] . block_notifier , 9 , 135 , true , header_135) ;
69636946 let node_txn = {
69646947 let mut node_txn = nodes[ 0 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) ;
69656948 assert_eq ! ( node_txn. len( ) , 1 ) ;
69666949
69676950 assert_eq ! ( node_txn[ 0 ] . input. len( ) , 2 ) ;
6968- if node_txn[ 0 ] . input [ 0 ] . previous_output . txid == revoked_htlc_txn[ 0 ] . txid ( ) {
6969- assert_eq ! ( node_txn[ 0 ] . input[ 1 ] . previous_output. txid, revoked_htlc_txn[ 1 ] . txid( ) ) ;
6970- } else if node_txn[ 0 ] . input [ 0 ] . previous_output . txid == revoked_htlc_txn[ 1 ] . txid ( ) {
6971- assert_eq ! ( node_txn[ 0 ] . input[ 1 ] . previous_output. txid, revoked_htlc_txn[ 0 ] . txid( ) ) ;
6972- } else {
6973- panic ! ( ) ;
6974- }
6951+ check_spends ! ( node_txn[ 0 ] , revoked_htlc_txn[ 0 ] , revoked_htlc_txn[ 1 ] ) ;
69756952 //// Verify bumped tx is different and 25% bump heuristic
69766953 assert_ne ! ( first, node_txn[ 0 ] . txid( ) ) ;
69776954 let fee_2 = revoked_htlc_txn[ 0 ] . output [ 0 ] . value + revoked_htlc_txn[ 1 ] . output [ 0 ] . value - node_txn[ 0 ] . output [ 0 ] . value ;
0 commit comments