@@ -1695,14 +1695,19 @@ fn channel_monitor_network_test() {
1695
1695
let payment_preimage_2 = route_payment ( & nodes[ 3 ] , & vec ! ( & nodes[ 4 ] ) [ ..] , 3000000 ) . 0 ;
1696
1696
// CLTV expires at TEST_FINAL_CLTV + 1 (current height) + 1 (added in send_payment for
1697
1697
// buffer space).
1698
-
1699
1698
{
1700
1699
let mut header = BlockHeader { version : 0x20000000 , prev_blockhash : Default :: default ( ) , merkle_root : Default :: default ( ) , time : 42 , bits : 42 , nonce : 42 } ;
1701
1700
nodes[ 3 ] . chain_monitor . block_connected_checked ( & header, 7 , & Vec :: new ( ) [ ..] , & [ 0 ; 0 ] ) ;
1702
1701
for i in 8 ..TEST_FINAL_CLTV + 2 + HTLC_FAIL_TIMEOUT_BLOCKS + 6 {
1703
1702
header = BlockHeader { version : 0x20000000 , prev_blockhash : header. bitcoin_hash ( ) , merkle_root : Default :: default ( ) , time : 42 , bits : 42 , nonce : 42 } ;
1704
1703
nodes[ 3 ] . chain_monitor . block_connected_checked ( & header, i, & Vec :: new ( ) [ ..] , & [ 0 ; 0 ] ) ;
1705
1704
}
1705
+ {
1706
+ let mut node_txn = nodes[ 3 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) ;
1707
+ node_txn. swap_remove ( 0 ) ;
1708
+ node_txn. swap_remove ( 1 ) ;
1709
+ node_txn. truncate ( 2 ) ;
1710
+ }
1706
1711
1707
1712
let node_txn = test_txn_broadcast ( & nodes[ 3 ] , & chan_4, None , HTLCType :: TIMEOUT ) ;
1708
1713
@@ -2151,16 +2156,16 @@ fn test_htlc_on_chain_success() {
2151
2156
connect_blocks ( & nodes[ 1 ] . chain_monitor , HTLC_FAIL_ANTI_REORG_DELAY - 1 , 1 , true , header. bitcoin_hash ( ) ) ;
2152
2157
check_closed_broadcast ! ( nodes[ 1 ] ) ;
2153
2158
let node_txn = nodes[ 1 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) . clone ( ) ; // ChannelManager : 1 (commitment tx), ChannelMonitor : 1 (HTLC-Success) * 2 (block-rescan)
2154
- assert_eq ! ( node_txn. len( ) , 3 ) ;
2159
+ assert_eq ! ( node_txn. len( ) , 5 ) ;
2155
2160
assert_eq ! ( node_txn[ 0 ] , node_txn[ 1 ] ) ;
2156
2161
check_spends ! ( node_txn[ 0 ] , commitment_tx[ 0 ] . clone( ) ) ;
2157
2162
assert_eq ! ( node_txn[ 0 ] . input. len( ) , 2 ) ;
2158
2163
assert_eq ! ( node_txn[ 0 ] . input[ 0 ] . witness. last( ) . unwrap( ) . len( ) , OFFERED_HTLC_SCRIPT_WEIGHT ) ;
2159
2164
assert_eq ! ( node_txn[ 0 ] . input[ 1 ] . witness. last( ) . unwrap( ) . len( ) , OFFERED_HTLC_SCRIPT_WEIGHT ) ;
2160
2165
assert_eq ! ( node_txn[ 0 ] . lock_time, 0 ) ;
2161
2166
assert ! ( node_txn[ 0 ] . output[ 0 ] . script_pubkey. is_v0_p2wpkh( ) ) ; // direct payment
2162
- check_spends ! ( node_txn[ 2 ] , chan_1. 3 . clone( ) ) ;
2163
- assert_eq ! ( node_txn[ 2 ] . input[ 0 ] . witness. clone( ) . last( ) . unwrap( ) . len( ) , 71 ) ;
2167
+ check_spends ! ( node_txn[ 4 ] , chan_1. 3 . clone( ) ) ;
2168
+ assert_eq ! ( node_txn[ 4 ] . input[ 0 ] . witness. clone( ) . last( ) . unwrap( ) . len( ) , 71 ) ;
2164
2169
// We don't bother to check that B can claim the HTLC output on its commitment tx here as
2165
2170
// we already checked the same situation with A.
2166
2171
@@ -3643,7 +3648,7 @@ fn test_static_spendable_outputs_preimage_tx() {
3643
3648
check_spends ! ( node_txn[ 0 ] , commitment_tx[ 0 ] . clone( ) ) ;
3644
3649
assert_eq ! ( node_txn[ 0 ] , node_txn[ 1 ] ) ;
3645
3650
assert_eq ! ( node_txn[ 0 ] . input[ 0 ] . witness. last( ) . unwrap( ) . len( ) , OFFERED_HTLC_SCRIPT_WEIGHT ) ;
3646
- check_spends ! ( node_txn[ 2 ] , chan_1. 3 . clone( ) ) ;
3651
+ check_spends ! ( node_txn[ 3 ] , chan_1. 3 . clone( ) ) ;
3647
3652
3648
3653
let spend_txn = check_spendable_outputs ! ( nodes[ 1 ] , 1 ) ; // , 0, 0, 1, 1);
3649
3654
assert_eq ! ( spend_txn. len( ) , 2 ) ;
@@ -3861,8 +3866,8 @@ fn test_onchain_to_onchain_claim() {
3861
3866
nodes[ 1 ] . chain_monitor . block_connected_with_filtering ( & Block { header, txdata : vec ! [ commitment_tx[ 0 ] . clone( ) ] } , 1 ) ;
3862
3867
connect_blocks ( & nodes[ 1 ] . chain_monitor , HTLC_FAIL_ANTI_REORG_DELAY - 1 , 1 , true , header. bitcoin_hash ( ) ) ;
3863
3868
let b_txn = nodes[ 1 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) ;
3864
- assert_eq ! ( b_txn. len( ) , 3 ) ;
3865
- check_spends ! ( b_txn[ 2 ] , chan_1. 3 ) ; // Local commitment tx, issued by ChannelManager
3869
+ assert_eq ! ( b_txn. len( ) , 4 ) ;
3870
+ check_spends ! ( b_txn[ 3 ] , chan_1. 3 ) ; // Local commitment tx, issued by ChannelManager
3866
3871
assert_eq ! ( b_txn[ 0 ] , b_txn[ 1 ] ) ; // HTLC-Success tx, issued by ChannelMonitor, * 2 due to block rescan
3867
3872
check_spends ! ( b_txn[ 0 ] , commitment_tx[ 0 ] . clone( ) ) ;
3868
3873
assert_eq ! ( b_txn[ 0 ] . input[ 0 ] . witness. clone( ) . last( ) . unwrap( ) . len( ) , OFFERED_HTLC_SCRIPT_WEIGHT ) ;
0 commit comments