@@ -3699,7 +3699,7 @@ mod tests {
3699
3699
}
3700
3700
}
3701
3701
3702
- fn close_channel ( outbound_node : & Node , inbound_node : & Node , channel_id : & [ u8 ; 32 ] , funding_tx : Transaction , close_inbound_first : bool ) -> ( msgs:: ChannelUpdate , msgs:: ChannelUpdate ) {
3702
+ 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 ) {
3703
3703
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) } ;
3704
3704
let ( node_b, broadcaster_b) = if close_inbound_first { ( & outbound_node. node , & outbound_node. tx_broadcaster ) } else { ( & inbound_node. node , & inbound_node. tx_broadcaster ) } ;
3705
3705
let ( tx_a, tx_b) ;
@@ -3762,7 +3762,7 @@ mod tests {
3762
3762
assert_eq ! ( tx_a, tx_b) ;
3763
3763
check_spends ! ( tx_a, funding_tx) ;
3764
3764
3765
- ( as_update, bs_update)
3765
+ ( as_update, bs_update, tx_a )
3766
3766
}
3767
3767
3768
3768
struct SendEvent {
@@ -7952,4 +7952,22 @@ mod tests {
7952
7952
check_spends ! ( spend_txn[ 0 ] , local_txn[ 0 ] . clone( ) ) ;
7953
7953
check_spends ! ( spend_txn[ 1 ] , node_txn[ 0 ] . clone( ) ) ;
7954
7954
}
7955
+
7956
+ #[ test]
7957
+ fn test_static_output_closing_tx ( ) {
7958
+ let nodes = create_network ( 2 ) ;
7959
+
7960
+ let chan = create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
7961
+
7962
+ send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] ) [ ..] , 8000000 ) ;
7963
+ let closing_tx = close_channel ( & nodes[ 0 ] , & nodes[ 1 ] , & chan. 2 , chan. 3 , true ) . 2 ;
7964
+
7965
+ let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
7966
+ let spend_tx = check_static_output ! ( events, nodes, 0 , 0 , 2 , 0 ) ;
7967
+ check_spends ! ( spend_tx, closing_tx. clone( ) ) ;
7968
+
7969
+ let events = nodes[ 1 ] . node . get_and_clear_pending_events ( ) ;
7970
+ let spend_tx = check_static_output ! ( events, nodes, 0 , 0 , 2 , 1 ) ;
7971
+ check_spends ! ( spend_tx, closing_tx) ;
7972
+ }
7955
7973
}
0 commit comments