@@ -51,7 +51,6 @@ use std::collections::{BTreeSet, HashMap, HashSet};
51
51
use std:: default:: Default ;
52
52
use std:: sync:: Mutex ;
53
53
use std:: sync:: atomic:: Ordering ;
54
- use std:: mem;
55
54
56
55
use ln:: functional_test_utils:: * ;
57
56
use ln:: chan_utils:: CommitmentTransaction ;
@@ -3532,37 +3531,6 @@ fn test_force_close_fail_back() {
3532
3531
check_spends ! ( node_txn[ 0 ] , tx) ;
3533
3532
}
3534
3533
3535
- #[ test]
3536
- fn test_unconf_chan ( ) {
3537
- // After creating a chan between nodes, we disconnect all blocks previously seen to force a channel close on nodes[0] side
3538
- let chanmon_cfgs = create_chanmon_cfgs ( 2 ) ;
3539
- let node_cfgs = create_node_cfgs ( 2 , & chanmon_cfgs) ;
3540
- let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ None , None ] ) ;
3541
- let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
3542
- create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
3543
-
3544
- let channel_state = nodes[ 0 ] . node . channel_state . lock ( ) . unwrap ( ) ;
3545
- assert_eq ! ( channel_state. by_id. len( ) , 1 ) ;
3546
- assert_eq ! ( channel_state. short_to_id. len( ) , 1 ) ;
3547
- mem:: drop ( channel_state) ;
3548
-
3549
- let mut headers = Vec :: new ( ) ;
3550
- let mut header = BlockHeader { version : 0x20000000 , prev_blockhash : Default :: default ( ) , merkle_root : Default :: default ( ) , time : 42 , bits : 42 , nonce : 42 } ;
3551
- headers. push ( header. clone ( ) ) ;
3552
- for _i in 2 ..100 {
3553
- header = BlockHeader { version : 0x20000000 , prev_blockhash : header. block_hash ( ) , merkle_root : Default :: default ( ) , time : 42 , bits : 42 , nonce : 42 } ;
3554
- headers. push ( header. clone ( ) ) ;
3555
- }
3556
- while !headers. is_empty ( ) {
3557
- nodes[ 0 ] . node . block_disconnected ( & headers. pop ( ) . unwrap ( ) ) ;
3558
- }
3559
- check_closed_broadcast ! ( nodes[ 0 ] , false ) ;
3560
- check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
3561
- let channel_state = nodes[ 0 ] . node . channel_state . lock ( ) . unwrap ( ) ;
3562
- assert_eq ! ( channel_state. by_id. len( ) , 0 ) ;
3563
- assert_eq ! ( channel_state. short_to_id. len( ) , 0 ) ;
3564
- }
3565
-
3566
3534
#[ test]
3567
3535
fn test_simple_peer_disconnect ( ) {
3568
3536
// Test that we can reconnect when there are no lost messages
@@ -8054,103 +8022,6 @@ fn test_bump_penalty_txn_on_remote_commitment() {
8054
8022
nodes[ 1 ] . node . get_and_clear_pending_msg_events ( ) ;
8055
8023
}
8056
8024
8057
- #[ test]
8058
- fn test_set_outpoints_partial_claiming ( ) {
8059
- // - remote party claim tx, new bump tx
8060
- // - disconnect remote claiming tx, new bump
8061
- // - disconnect tx, see no tx anymore
8062
- let chanmon_cfgs = create_chanmon_cfgs ( 2 ) ;
8063
- let node_cfgs = create_node_cfgs ( 2 , & chanmon_cfgs) ;
8064
- let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ None , None ] ) ;
8065
- let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
8066
-
8067
- let chan = create_announced_chan_between_nodes_with_value ( & nodes, 0 , 1 , 1000000 , 59000000 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
8068
- let payment_preimage_1 = route_payment ( & nodes[ 1 ] , & vec ! ( & nodes[ 0 ] ) [ ..] , 3_000_000 ) . 0 ;
8069
- let payment_preimage_2 = route_payment ( & nodes[ 1 ] , & vec ! ( & nodes[ 0 ] ) [ ..] , 3_000_000 ) . 0 ;
8070
-
8071
- // Remote commitment txn with 4 outputs: to_local, to_remote, 2 outgoing HTLC
8072
- let remote_txn = get_local_commitment_txn ! ( nodes[ 1 ] , chan. 2 ) ;
8073
- assert_eq ! ( remote_txn. len( ) , 3 ) ;
8074
- assert_eq ! ( remote_txn[ 0 ] . output. len( ) , 4 ) ;
8075
- assert_eq ! ( remote_txn[ 0 ] . input. len( ) , 1 ) ;
8076
- assert_eq ! ( remote_txn[ 0 ] . input[ 0 ] . previous_output. txid, chan. 3 . txid( ) ) ;
8077
- check_spends ! ( remote_txn[ 1 ] , remote_txn[ 0 ] ) ;
8078
- check_spends ! ( remote_txn[ 2 ] , remote_txn[ 0 ] ) ;
8079
-
8080
- // Connect blocks on node A to advance height towards TEST_FINAL_CLTV
8081
- let prev_header_100 = connect_blocks ( & nodes[ 1 ] , 100 , 0 , false , Default :: default ( ) ) ;
8082
- // Provide node A with both preimage
8083
- nodes[ 0 ] . node . claim_funds ( payment_preimage_1, & None , 3_000_000 ) ;
8084
- nodes[ 0 ] . node . claim_funds ( payment_preimage_2, & None , 3_000_000 ) ;
8085
- check_added_monitors ! ( nodes[ 0 ] , 2 ) ;
8086
- nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
8087
- nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
8088
-
8089
- // Connect blocks on node A commitment transaction
8090
- let header = BlockHeader { version : 0x20000000 , prev_blockhash : prev_header_100, merkle_root : Default :: default ( ) , time : 42 , bits : 42 , nonce : 42 } ;
8091
- connect_block ( & nodes[ 0 ] , & Block { header, txdata : vec ! [ remote_txn[ 0 ] . clone( ) ] } , 101 ) ;
8092
- check_closed_broadcast ! ( nodes[ 0 ] , false ) ;
8093
- check_added_monitors ! ( nodes[ 0 ] , 1 ) ;
8094
- // Verify node A broadcast tx claiming both HTLCs
8095
- {
8096
- let mut node_txn = nodes[ 0 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) ;
8097
- // ChannelMonitor: claim tx, ChannelManager: local commitment tx + HTLC-Success*2
8098
- assert_eq ! ( node_txn. len( ) , 4 ) ;
8099
- check_spends ! ( node_txn[ 0 ] , remote_txn[ 0 ] ) ;
8100
- check_spends ! ( node_txn[ 1 ] , chan. 3 ) ;
8101
- check_spends ! ( node_txn[ 2 ] , node_txn[ 1 ] ) ;
8102
- check_spends ! ( node_txn[ 3 ] , node_txn[ 1 ] ) ;
8103
- assert_eq ! ( node_txn[ 0 ] . input. len( ) , 2 ) ;
8104
- node_txn. clear ( ) ;
8105
- }
8106
-
8107
- // Connect blocks on node B
8108
- connect_blocks ( & nodes[ 1 ] , 135 , 0 , false , Default :: default ( ) ) ;
8109
- check_closed_broadcast ! ( nodes[ 1 ] , false ) ;
8110
- check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
8111
- // Verify node B broadcast 2 HTLC-timeout txn
8112
- let partial_claim_tx = {
8113
- let node_txn = nodes[ 1 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) ;
8114
- assert_eq ! ( node_txn. len( ) , 3 ) ;
8115
- check_spends ! ( node_txn[ 1 ] , node_txn[ 0 ] ) ;
8116
- check_spends ! ( node_txn[ 2 ] , node_txn[ 0 ] ) ;
8117
- assert_eq ! ( node_txn[ 1 ] . input. len( ) , 1 ) ;
8118
- assert_eq ! ( node_txn[ 2 ] . input. len( ) , 1 ) ;
8119
- node_txn[ 1 ] . clone ( )
8120
- } ;
8121
-
8122
- // Broadcast partial claim on node A, should regenerate a claiming tx with HTLC dropped
8123
- let header = BlockHeader { version : 0x20000000 , prev_blockhash : header. block_hash ( ) , merkle_root : Default :: default ( ) , time : 42 , bits : 42 , nonce : 42 } ;
8124
- connect_block ( & nodes[ 0 ] , & Block { header, txdata : vec ! [ partial_claim_tx. clone( ) ] } , 102 ) ;
8125
- {
8126
- let mut node_txn = nodes[ 0 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) ;
8127
- assert_eq ! ( node_txn. len( ) , 1 ) ;
8128
- check_spends ! ( node_txn[ 0 ] , remote_txn[ 0 ] ) ;
8129
- assert_eq ! ( node_txn[ 0 ] . input. len( ) , 1 ) ; //dropped HTLC
8130
- node_txn. clear ( ) ;
8131
- }
8132
- nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
8133
-
8134
- // Disconnect last block on node A, should regenerate a claiming tx with HTLC dropped
8135
- disconnect_block ( & nodes[ 0 ] , & header, 102 ) ;
8136
- {
8137
- let mut node_txn = nodes[ 0 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) ;
8138
- assert_eq ! ( node_txn. len( ) , 1 ) ;
8139
- check_spends ! ( node_txn[ 0 ] , remote_txn[ 0 ] ) ;
8140
- assert_eq ! ( node_txn[ 0 ] . input. len( ) , 2 ) ; //resurrected HTLC
8141
- node_txn. clear ( ) ;
8142
- }
8143
-
8144
- //// Disconnect one more block and then reconnect multiple no transaction should be generated
8145
- disconnect_block ( & nodes[ 0 ] , & header, 101 ) ;
8146
- connect_blocks ( & nodes[ 1 ] , 15 , 101 , false , prev_header_100) ;
8147
- {
8148
- let mut node_txn = nodes[ 0 ] . tx_broadcaster . txn_broadcasted . lock ( ) . unwrap ( ) ;
8149
- assert_eq ! ( node_txn. len( ) , 0 ) ;
8150
- node_txn. clear ( ) ;
8151
- }
8152
- }
8153
-
8154
8025
#[ test]
8155
8026
fn test_counterparty_raa_skip_no_crash ( ) {
8156
8027
// Previously, if our counterparty sent two RAAs in a row without us having provided a
0 commit comments