File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
lightning-transaction-sync/src Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ use std::collections::{HashMap, HashSet};
22
22
static BITCOIND : OnceCell < BitcoinD > = OnceCell :: new ( ) ;
23
23
static ELECTRSD : OnceCell < ElectrsD > = OnceCell :: new ( ) ;
24
24
static PREMINE : OnceCell < ( ) > = OnceCell :: new ( ) ;
25
- static MINER_LOCK : Mutex < ( ) > = Mutex :: new ( ( ) ) ;
25
+ static MINER_LOCK : OnceCell < Mutex < ( ) > > = OnceCell :: new ( ) ;
26
26
27
27
fn get_bitcoind ( ) -> & ' static BitcoinD {
28
28
BITCOIND . get_or_init ( || {
@@ -51,7 +51,8 @@ fn get_electrsd() -> &'static ElectrsD {
51
51
}
52
52
53
53
fn generate_blocks_and_wait ( num : usize ) {
54
- let _miner = MINER_LOCK . lock ( ) . unwrap ( ) ;
54
+ let miner_lock = MINER_LOCK . get_or_init ( || Mutex :: new ( ( ) ) ) ;
55
+ let _miner = miner_lock. lock ( ) . unwrap ( ) ;
55
56
let cur_height = get_bitcoind ( ) . client . get_block_count ( ) . unwrap ( ) ;
56
57
let address = get_bitcoind ( ) . client . get_new_address ( Some ( "test" ) , Some ( AddressType :: Legacy ) ) . unwrap ( ) ;
57
58
let _block_hashes = get_bitcoind ( ) . client . generate_to_address ( num as u64 , & address) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments