@@ -3675,7 +3675,7 @@ mod tests {
3675
3675
}
3676
3676
}
3677
3677
3678
- fn close_channel ( outbound_node : & Node , inbound_node : & Node , channel_id : & [ u8 ; 32 ] , funding_tx : Transaction , close_inbound_first : bool ) -> ( msgs:: ChannelUpdate , msgs:: ChannelUpdate ) {
3678
+ 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 ) {
3679
3679
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) } ;
3680
3680
let ( node_b, broadcaster_b) = if close_inbound_first { ( & outbound_node. node , & outbound_node. tx_broadcaster ) } else { ( & inbound_node. node , & inbound_node. tx_broadcaster ) } ;
3681
3681
let ( tx_a, tx_b) ;
@@ -3738,7 +3738,7 @@ mod tests {
3738
3738
assert_eq ! ( tx_a, tx_b) ;
3739
3739
check_spends ! ( tx_a, funding_tx) ;
3740
3740
3741
- ( as_update, bs_update)
3741
+ ( as_update, bs_update, tx_a )
3742
3742
}
3743
3743
3744
3744
struct SendEvent {
@@ -7888,4 +7888,20 @@ mod tests {
7888
7888
let spend_tx = check_dynamic_output ! ( events, 0 , 1 , node_txn[ 0 ] . output[ 0 ] . value) ;
7889
7889
check_spends ! ( spend_tx, node_txn[ 0 ] . clone( ) ) ;
7890
7890
}
7891
+
7892
+ #[ test]
7893
+ fn test_static_output_closing_tx ( ) {
7894
+ let nodes = create_network ( 2 ) ;
7895
+
7896
+ let chan = create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
7897
+
7898
+ send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] ) [ ..] , 8000000 ) ;
7899
+ let closing_tx = close_channel ( & nodes[ 0 ] , & nodes[ 1 ] , & chan. 2 , chan. 3 , true ) . 2 ;
7900
+
7901
+ let header = BlockHeader { version : 0x20000000 , prev_blockhash : Default :: default ( ) , merkle_root : Default :: default ( ) , time : 42 , bits : 42 , nonce : 42 } ;
7902
+ nodes[ 0 ] . chain_monitor . block_connected_with_filtering ( & Block { header, txdata : vec ! [ closing_tx. clone( ) ] } , 1 ) ;
7903
+ let events = nodes[ 0 ] . chan_monitor . simple_monitor . get_and_clear_pending_events ( ) ;
7904
+ let spend_tx = check_static_output ! ( events, nodes, 0 , 1 , 2 , 0 ) ;
7905
+ check_spends ! ( spend_tx, closing_tx) ;
7906
+ }
7891
7907
}
0 commit comments