fix: mutex dead lock between difficulty_iter and txhashset_write (#1617)

fix #1611
This commit is contained in:
Gary Yu 2018-10-01 11:51:15 +08:00 committed by GitHub
parent 73ddd1d01d
commit 6ad54b9840
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -963,8 +963,8 @@ impl Chain {
/// running backward. Specialized to return information pertaining to block /// running backward. Specialized to return information pertaining to block
/// difficulty calculation (timestamp and previous difficulties). /// difficulty calculation (timestamp and previous difficulties).
pub fn difficulty_iter(&self) -> store::DifficultyIter { pub fn difficulty_iter(&self) -> store::DifficultyIter {
let head = self.head.lock().unwrap();
let batch = self.store.batch().unwrap(); let batch = self.store.batch().unwrap();
let head = self.head.lock().unwrap();
store::DifficultyIter::from(head.last_block_h, batch) store::DifficultyIter::from(head.last_block_h, batch)
} }