@@ -2360,16 +2360,9 @@ fn claim_htlc_outputs_single_tx() {
2360
2360
assert_eq ! ( node_txn[ 2 ] . input. len( ) , 1 ) ;
2361
2361
assert_eq ! ( node_txn[ 3 ] . input. len( ) , 1 ) ;
2362
2362
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 ] ) ;
2373
2366
2374
2367
let mut witness_lens = BTreeSet :: new ( ) ;
2375
2368
witness_lens. insert ( node_txn[ 2 ] . input [ 0 ] . witness . last ( ) . unwrap ( ) . len ( ) ) ;
@@ -6924,13 +6917,7 @@ fn test_bump_penalty_txn_on_revoked_htlcs() {
6924
6917
// Verify claim tx are spending revoked HTLC txn
6925
6918
assert_eq ! ( node_txn[ 4 ] . input. len( ) , 2 ) ;
6926
6919
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 ] ) ;
6934
6921
first = node_txn[ 4 ] . txid ( ) ;
6935
6922
// Store both feerates for later comparison
6936
6923
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() {
6954
6941
6955
6942
// Few more blocks to confirm penalty txn
6956
6943
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( ) ) ;
6962
6945
let header_144 = connect_blocks ( & nodes[ 0 ] . block_notifier , 9 , 135 , true , header_135) ;
6963
6946
let node_txn = {
6964
6947
let mut node_txn = nodes[ 0 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) ;
6965
6948
assert_eq ! ( node_txn. len( ) , 1 ) ;
6966
6949
6967
6950
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 ] ) ;
6975
6952
//// Verify bumped tx is different and 25% bump heuristic
6976
6953
assert_ne ! ( first, node_txn[ 0 ] . txid( ) ) ;
6977
6954
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