diff --git a/chain/src/chain.rs b/chain/src/chain.rs index 631040d9..fdb19aec 100644 --- a/chain/src/chain.rs +++ b/chain/src/chain.rs @@ -127,6 +127,7 @@ pub struct Chain { head: Arc>, orphans: Arc, + txhashset_lock: Arc>, txhashset: Arc>, // POW verification function @@ -233,6 +234,7 @@ impl Chain { adapter: adapter, head: Arc::new(Mutex::new(head)), orphans: Arc::new(OrphanBlockPool::new()), + txhashset_lock: Arc::new(Mutex::new(false)), txhashset: Arc::new(RwLock::new(txhashset)), pow_verifier: pow_verifier, }) @@ -526,6 +528,7 @@ impl Chain { rewind_to_kernel: u64, txhashset_data: File, ) -> Result<(), Error> { + let _lock = self.txhashset_lock.lock().unwrap(); let head = self.head().unwrap(); let header_head = self.get_header_head().unwrap(); if header_head.height - head.height < global::cut_through_horizon() as u64 {