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};
2222static BITCOIND : OnceCell < BitcoinD > = OnceCell :: new ( ) ;
2323static ELECTRSD : OnceCell < ElectrsD > = OnceCell :: new ( ) ;
2424static PREMINE : OnceCell < ( ) > = OnceCell :: new ( ) ;
25- static MINER_LOCK : Mutex < ( ) > = Mutex :: new ( ( ) ) ;
25+ static MINER_LOCK : OnceCell < Mutex < ( ) > > = OnceCell :: new ( ) ;
2626
2727fn get_bitcoind ( ) -> & ' static BitcoinD {
2828 BITCOIND . get_or_init ( || {
@@ -51,7 +51,8 @@ fn get_electrsd() -> &'static ElectrsD {
5151}
5252
5353fn 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 ( ) ;
5556 let cur_height = get_bitcoind ( ) . client . get_block_count ( ) . unwrap ( ) ;
5657 let address = get_bitcoind ( ) . client . get_new_address ( Some ( "test" ) , Some ( AddressType :: Legacy ) ) . unwrap ( ) ;
5758 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