@@ -61,17 +61,22 @@ pub fn confirm_transaction<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, tx: &Tran
6161 connect_blocks ( node, CHAN_CONFIRM_DEPTH - 1 ) ;
6262 scid
6363}
64- /// Mine a signle block containing the given transaction
64+ /// Mine a single block containing the given transaction
6565pub fn mine_transaction < ' a , ' b , ' c , ' d > ( node : & ' a Node < ' b , ' c , ' d > , tx : & Transaction ) {
6666 let height = node. best_block_info ( ) . 1 + 1 ;
6767 confirm_transaction_at ( node, tx, height) ;
6868}
69+ /// Mine a single block containing the given transactions
70+ pub fn mine_transactions < ' a , ' b , ' c , ' d > ( node : & ' a Node < ' b , ' c , ' d > , txn : & [ & Transaction ] ) {
71+ let height = node. best_block_info ( ) . 1 + 1 ;
72+ confirm_transactions_at ( node, txn, height) ;
73+ }
6974/// Mine the given transaction at the given height, mining blocks as required to build to that
7075/// height
7176///
7277/// Returns the SCID a channel confirmed in the given transaction will have, assuming the funding
7378/// output is the 1st output in the transaction.
74- pub fn confirm_transaction_at < ' a , ' b , ' c , ' d > ( node : & ' a Node < ' b , ' c , ' d > , tx : & Transaction , conf_height : u32 ) -> u64 {
79+ pub fn confirm_transactions_at < ' a , ' b , ' c , ' d > ( node : & ' a Node < ' b , ' c , ' d > , txn : & [ & Transaction ] , conf_height : u32 ) -> u64 {
7580 let first_connect_height = node. best_block_info ( ) . 1 + 1 ;
7681 assert ! ( first_connect_height <= conf_height) ;
7782 if conf_height > first_connect_height {
@@ -84,10 +89,15 @@ pub fn confirm_transaction_at<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, tx: &T
8489 for _ in 0 ..* node. network_chan_count . borrow ( ) { // Make sure we don't end up with channels at the same short id by offsetting by chan_count
8590 block. txdata . push ( Transaction { version : 0 , lock_time : PackedLockTime :: ZERO , input : Vec :: new ( ) , output : Vec :: new ( ) } ) ;
8691 }
87- block. txdata . push ( tx. clone ( ) ) ;
92+ for tx in txn {
93+ block. txdata . push ( ( * tx) . clone ( ) ) ;
94+ }
8895 connect_block ( node, & block) ;
8996 scid_utils:: scid_from_parts ( conf_height as u64 , block. txdata . len ( ) as u64 - 1 , 0 ) . unwrap ( )
9097}
98+ pub fn confirm_transaction_at < ' a , ' b , ' c , ' d > ( node : & ' a Node < ' b , ' c , ' d > , tx : & Transaction , conf_height : u32 ) -> u64 {
99+ confirm_transactions_at ( node, & [ tx] , conf_height)
100+ }
91101
92102/// The possible ways we may notify a ChannelManager of a new block
93103#[ derive( Clone , Copy , Debug , PartialEq ) ]
0 commit comments