Skip to content

Commit da81c5d

Browse files
authored
Merge pull request DMDcoin#225 from SurfingNerd/release-prep-0.11.1
Release prep 0.11.1
2 parents 148a20f + 711f72e commit da81c5d

File tree

5 files changed

+25
-12
lines changed

5 files changed

+25
-12
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11

2+
## Diamond Node Software 3.3.5-hbbft-0.11.1
3+
4+
- caching of SyncStatus to prevent deadlocks https://github.com/DMDcoin/diamond-node/issues/223
25

36
## Diamond Node Software 3.3.5-hbbft-0.11.0
47

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description = "Diamond Node"
33
name = "diamond-node"
44
# NOTE Make sure to update util/version/Cargo.toml as well
5-
version = "3.3.5-hbbft-0.11.0-rc3"
5+
version = "3.3.5-hbbft-0.11.1"
66
license = "GPL-3.0"
77
authors = [
88
"bit.diamonds developers",

crates/ethcore/sync/src/chain/mod.rs

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,8 @@ pub struct ChainSyncApi {
428428
priority_tasks: Mutex<mpsc::Receiver<PriorityTask>>,
429429
/// The rest of sync data
430430
sync: RwLock<ChainSync>,
431+
/// last known sync state.
432+
last_known_sync_status: Mutex<SyncStatus>,
431433
}
432434

433435
impl ChainSyncApi {
@@ -439,14 +441,14 @@ impl ChainSyncApi {
439441
priority_tasks: mpsc::Receiver<PriorityTask>,
440442
new_transaction_hashes: crossbeam_channel::Receiver<H256>,
441443
) -> Self {
444+
let sync = ChainSync::new(config, chain, fork_filter, new_transaction_hashes);
445+
446+
let last_known_sync_status = sync.status();
447+
442448
ChainSyncApi {
443-
sync: RwLock::new(ChainSync::new(
444-
config,
445-
chain,
446-
fork_filter,
447-
new_transaction_hashes,
448-
)),
449+
sync: RwLock::new(sync),
449450
priority_tasks: Mutex::new(priority_tasks),
451+
last_known_sync_status: Mutex::new(last_known_sync_status),
450452
}
451453
}
452454

@@ -461,9 +463,17 @@ impl ChainSyncApi {
461463
ids.iter().map(|id| sync.peer_info(id)).collect()
462464
}
463465

464-
/// Returns synchonization status
466+
/// Returns best known synchonization status
465467
pub fn status(&self) -> SyncStatus {
466-
self.sync.read().status()
468+
if let Some(sync) = self.sync.try_read_for(Duration::from_millis(50)) {
469+
let status = sync.status();
470+
*self.last_known_sync_status.lock() = status.clone();
471+
return status;
472+
}
473+
474+
// we return that last known sync status here, in cases we could not get the most recent information.
475+
// see also: https://github.com/DMDcoin/diamond-node/issues/223
476+
return self.last_known_sync_status.lock().clone();
467477
}
468478

469479
/// Returns pending transactions propagation statistics

crates/util/version/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "parity-version"
33
# NOTE: this value is used for OpenEthereum version string (via env CARGO_PKG_VERSION)
4-
version = "3.3.5-hbbft-0.11.0-rc3"
4+
version = "3.3.5-hbbft-0.11.1"
55
authors = [
66
"bit.diamonds developers",
77
"OpenEthereum developers",

0 commit comments

Comments
 (0)