@@ -3696,7 +3696,7 @@ mod tests {
3696
3696
}
3697
3697
}
3698
3698
3699
- fn close_channel ( outbound_node : & Node , inbound_node : & Node , channel_id : & [ u8 ; 32 ] , funding_tx : Transaction , close_inbound_first : bool ) -> ( msgs:: ChannelUpdate , msgs:: ChannelUpdate ) {
3699
+ fn close_channel ( outbound_node : & Node , inbound_node : & Node , channel_id : & [ u8 ; 32 ] , funding_tx : Transaction , close_inbound_first : bool ) -> ( msgs:: ChannelUpdate , msgs:: ChannelUpdate , Transaction ) {
3700
3700
let ( node_a, broadcaster_a, struct_a) = if close_inbound_first { ( & inbound_node. node , & inbound_node. tx_broadcaster , inbound_node) } else { ( & outbound_node. node , & outbound_node. tx_broadcaster , outbound_node) } ;
3701
3701
let ( node_b, broadcaster_b) = if close_inbound_first { ( & outbound_node. node , & outbound_node. tx_broadcaster ) } else { ( & inbound_node. node , & inbound_node. tx_broadcaster ) } ;
3702
3702
let ( tx_a, tx_b) ;
@@ -3759,7 +3759,7 @@ mod tests {
3759
3759
assert_eq ! ( tx_a, tx_b) ;
3760
3760
check_spends ! ( tx_a, funding_tx) ;
3761
3761
3762
- ( as_update, bs_update)
3762
+ ( as_update, bs_update, tx_a )
3763
3763
}
3764
3764
3765
3765
struct SendEvent {
@@ -7997,4 +7997,22 @@ mod tests {
7997
7997
check_spends ! ( spend_txn[ 0 ] , local_txn[ 0 ] . clone( ) ) ;
7998
7998
check_spends ! ( spend_txn[ 1 ] , node_txn[ 0 ] . clone( ) ) ;
7999
7999
}
8000
+
8001
+ #[ test]
8002
+ fn test_static_output_closing_tx ( ) {
8003
+ let nodes = create_network ( 2 ) ;
8004
+
8005
+ let chan = create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
8006
+
8007
+ send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] ) [ ..] , 8000000 ) ;
8008
+ let closing_tx = close_channel ( & nodes[ 0 ] , & nodes[ 1 ] , & chan. 2 , chan. 3 , true ) . 2 ;
8009
+
8010
+ let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
8011
+ let spend_tx = check_static_output ! ( events, nodes, 0 , 0 , 2 , 0 ) ;
8012
+ check_spends ! ( spend_tx, closing_tx. clone( ) ) ;
8013
+
8014
+ let events = nodes[ 1 ] . node . get_and_clear_pending_events ( ) ;
8015
+ let spend_tx = check_static_output ! ( events, nodes, 0 , 0 , 2 , 1 ) ;
8016
+ check_spends ! ( spend_tx, closing_tx) ;
8017
+ }
8000
8018
}
0 commit comments