@@ -61,17 +61,22 @@ pub fn confirm_transaction<'a, 'b, 'c, 'd>(node: &'a Node<'b, 'c, 'd>, tx: &Tran
61
61
connect_blocks ( node, CHAN_CONFIRM_DEPTH - 1 ) ;
62
62
scid
63
63
}
64
- /// Mine a signle block containing the given transaction
64
+ /// Mine a single block containing the given transaction
65
65
pub fn mine_transaction < ' a , ' b , ' c , ' d > ( node : & ' a Node < ' b , ' c , ' d > , tx : & Transaction ) {
66
66
let height = node. best_block_info ( ) . 1 + 1 ;
67
67
confirm_transaction_at ( node, tx, height) ;
68
68
}
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
+ }
69
74
/// Mine the given transaction at the given height, mining blocks as required to build to that
70
75
/// height
71
76
///
72
77
/// Returns the SCID a channel confirmed in the given transaction will have, assuming the funding
73
78
/// 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 {
75
80
let first_connect_height = node. best_block_info ( ) . 1 + 1 ;
76
81
assert ! ( first_connect_height <= conf_height) ;
77
82
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
84
89
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
85
90
block. txdata . push ( Transaction { version : 0 , lock_time : PackedLockTime :: ZERO , input : Vec :: new ( ) , output : Vec :: new ( ) } ) ;
86
91
}
87
- block. txdata . push ( tx. clone ( ) ) ;
92
+ for tx in txn {
93
+ block. txdata . push ( ( * tx) . clone ( ) ) ;
94
+ }
88
95
connect_block ( node, & block) ;
89
96
scid_utils:: scid_from_parts ( conf_height as u64 , block. txdata . len ( ) as u64 - 1 , 0 ) . unwrap ( )
90
97
}
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
+ }
91
101
92
102
/// The possible ways we may notify a ChannelManager of a new block
93
103
#[ derive( Clone , Copy , Debug , PartialEq ) ]
0 commit comments