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