@@ -3569,49 +3569,6 @@ mod tests {
3569
3569
}
3570
3570
}
3571
3571
3572
- //#[test]
3573
- fn test_htlc_on_chain_timeout ( ) {
3574
- // Test that in case of an unilateral close onchain, we detect the state of HTLC (timeout) thanks to
3575
- // ChainWtachInterface and pass the timeout backward
3576
- // A -------> B --------> C --------> D (timeout)
3577
- // output input
3578
-
3579
- let nodes = create_network ( 4 ) ;
3580
-
3581
- // Create some initial channels
3582
- let chan_1 = create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
3583
- let chan_2 = create_announced_chan_between_nodes ( & nodes, 1 , 2 ) ;
3584
- let chan_3 = create_announced_chan_between_nodes ( & nodes, 2 , 3 ) ;
3585
-
3586
- // Rebalance the network a bit by relaying one payment through all the channels...
3587
- send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] , & nodes[ 3 ] ) [ ..] , 8000000 ) ;
3588
- send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] , & nodes[ 3 ] ) [ ..] , 8000000 ) ;
3589
- send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] , & nodes[ 3 ] ) [ ..] , 8000000 ) ;
3590
-
3591
- let ( payment_preimage, payment_hash) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] , & nodes[ 3 ] ) , 3000000 ) ;
3592
-
3593
- // broadcast legit commitment tx from D on C's chain
3594
- let commitment_tx = nodes[ 3 ] . node . channel_state . lock ( ) . unwrap ( ) . by_id . get ( & chan_3. 2 ) . unwrap ( ) . last_local_commitment_txn . clone ( ) ;
3595
- let header = BlockHeader { version : 0x20000000 , prev_blockhash : Default :: default ( ) , merkle_root : Default :: default ( ) , time : 42 , bits : 42 , nonce : 42 } ;
3596
-
3597
- // broadcast timeout tx on received
3598
- nodes[ 2 ] . chain_monitor . block_connected_with_filtering ( & Block { header, txdata : vec ! [ commitment_tx[ 0 ] . clone( ) ] } , 1 ) ;
3599
- test_txn_broadcast ( & nodes[ 2 ] , & chan_3, Some ( commitment_tx[ 0 ] . clone ( ) ) , HTLCType :: TIMEOUT ) ;
3600
- let events = nodes[ 2 ] . node . get_and_clear_pending_events ( ) ;
3601
- assert_eq ! ( events. len( ) , 1 ) ; //should be an UpdateFailHTLC event, verify it
3602
-
3603
- let commitment_tx = nodes[ 1 ] . node . channel_state . lock ( ) . unwrap ( ) . by_id . get ( & chan_2. 2 ) . unwrap ( ) . last_local_commitment_txn . clone ( ) ;
3604
- let header = BlockHeader { version : 0x20000000 , prev_blockhash : Default :: default ( ) , merkle_root : Default :: default ( ) , time : 42 , bits : 42 , nonce : 42 } ;
3605
- nodes[ 1 ] . chain_monitor . block_connected_with_filtering ( & Block { header, txdata : vec ! [ commitment_tx[ 0 ] . clone( ) ] } , 200 ) ;
3606
- let node_txn = test_txn_broadcast ( & nodes[ 1 ] , & chan_3, Some ( commitment_tx[ 0 ] . clone ( ) ) , HTLCType :: TIMEOUT ) ;
3607
- let events = nodes[ 1 ] . node . get_and_clear_pending_events ( ) ;
3608
- assert_eq ! ( events. len( ) , 1 ) ; //should be an UpdateFailHTLC event, verify it
3609
-
3610
-
3611
- //assert!(nodes[0].node.handle_update_fail_htlc(&nodes[1].node.get_our_node_id(), &events[0].updates.update_fulfill_htlcs[0]).is_ok());
3612
- }
3613
-
3614
- #[ test]
3615
3572
fn test_htlc_ignore_latest_remote_commitment ( ) {
3616
3573
// Test that HTLC transactions spending the latest remote commitment transaction are simply
3617
3574
// ignored if we cannot claim them. This originally tickled an invalid unwrap().
0 commit comments