@@ -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 {
@@ -7899,4 +7899,20 @@ mod tests {
7899
7899
check_spends ! ( spend_txn[ 0 ] , local_txn[ 0 ] . clone( ) ) ;
7900
7900
check_spends ! ( spend_txn[ 1 ] , node_txn[ 0 ] . clone( ) ) ;
7901
7901
}
7902
+
7903
+ #[ test]
7904
+ fn test_static_output_closing_tx ( ) {
7905
+ let nodes = create_network ( 2 ) ;
7906
+
7907
+ let chan = create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
7908
+
7909
+ send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] ) [ ..] , 8000000 ) ;
7910
+ let closing_tx = close_channel ( & nodes[ 0 ] , & nodes[ 1 ] , & chan. 2 , chan. 3 , true ) . 2 ;
7911
+
7912
+ let header = BlockHeader { version : 0x20000000 , prev_blockhash : Default :: default ( ) , merkle_root : Default :: default ( ) , time : 42 , bits : 42 , nonce : 42 } ;
7913
+ nodes[ 0 ] . chain_monitor . block_connected_with_filtering ( & Block { header, txdata : vec ! [ closing_tx. clone( ) ] } , 1 ) ;
7914
+ let events = nodes[ 0 ] . chan_monitor . simple_monitor . get_and_clear_pending_events ( ) ;
7915
+ let spend_tx = check_static_output ! ( events, nodes, 0 , 1 , 2 , 0 ) ;
7916
+ check_spends ! ( spend_tx, closing_tx) ;
7917
+ }
7902
7918
}
0 commit comments