diff --git a/substrate/Cargo.lock b/substrate/Cargo.lock index 8d5dd6ba47..a22bfe2a1b 100644 --- a/substrate/Cargo.lock +++ b/substrate/Cargo.lock @@ -3332,7 +3332,7 @@ dependencies = [ [[package]] name = "substrate" -version = "0.9.1" +version = "0.9.2" dependencies = [ "ctrlc 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/substrate/Cargo.toml b/substrate/Cargo.toml index ded75775aa..9f8c70270a 100644 --- a/substrate/Cargo.toml +++ b/substrate/Cargo.toml @@ -4,7 +4,7 @@ path = "node/src/main.rs" [package] name = "substrate" -version = "0.9.1" +version = "0.9.2" authors = ["Parity Technologies "] build = "build.rs" diff --git a/substrate/core/rpc/src/system/helpers.rs b/substrate/core/rpc/src/system/helpers.rs index 5a679de0ad..3ab75fb50e 100644 --- a/substrate/core/rpc/src/system/helpers.rs +++ b/substrate/core/rpc/src/system/helpers.rs @@ -43,6 +43,8 @@ pub struct Health { pub peers: usize, /// Is the node syncing pub is_syncing: bool, + /// Should this node have any peers + pub should_have_peers: bool, } /// Network Peer information diff --git a/substrate/core/rpc/src/system/mod.rs b/substrate/core/rpc/src/system/mod.rs index 1d33104483..a06aaaad23 100644 --- a/substrate/core/rpc/src/system/mod.rs +++ b/substrate/core/rpc/src/system/mod.rs @@ -103,21 +103,11 @@ impl SystemApi::Number> for Sy fn system_health(&self) -> Result { let status = self.sync.status(); - - let is_syncing = status.sync.is_major_syncing(); - let peers = status.num_peers; - - let health = Health { - peers, - is_syncing, - }; - - let has_no_peers = peers == 0 && self.should_have_peers; - if has_no_peers || is_syncing { - Err(error::ErrorKind::NotHealthy(health))? - } else { - Ok(health) - } + Ok(Health { + peers: status.num_peers, + is_syncing: status.sync.is_major_syncing(), + should_have_peers: self.should_have_peers, + }) } fn system_peers(&self) -> Result::Number>>> { diff --git a/substrate/core/rpc/src/system/tests.rs b/substrate/core/rpc/src/system/tests.rs index 976dbe509a..169d5b914b 100644 --- a/substrate/core/rpc/src/system/tests.rs +++ b/substrate/core/rpc/src/system/tests.rs @@ -97,11 +97,12 @@ fn system_properties_works() { #[test] fn system_health() { assert_matches!( - api(None).system_health().unwrap_err().kind(), - error::ErrorKind::NotHealthy(Health { + api(None).system_health().unwrap(), + Health { peers: 0, is_syncing: false, - }) + should_have_peers: true, + } ); assert_matches!( @@ -109,11 +110,12 @@ fn system_health() { peers: 5, is_syncing: true, is_dev: true, - }).system_health().unwrap_err().kind(), - error::ErrorKind::NotHealthy(Health { + }).system_health().unwrap(), + Health { peers: 5, is_syncing: true, - }) + should_have_peers: false, + } ); assert_eq!( @@ -125,6 +127,7 @@ fn system_health() { Health { peers: 5, is_syncing: false, + should_have_peers: true, } ); @@ -137,6 +140,7 @@ fn system_health() { Health { peers: 0, is_syncing: false, + should_have_peers: false, } ); } diff --git a/substrate/node/runtime/src/lib.rs b/substrate/node/runtime/src/lib.rs index cc0c195780..6295a38b6f 100644 --- a/substrate/node/runtime/src/lib.rs +++ b/substrate/node/runtime/src/lib.rs @@ -96,8 +96,8 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("node"), impl_name: create_runtime_str!("substrate-node"), authoring_version: 10, - spec_version: 12, - impl_version: 12, + spec_version: 14, + impl_version: 14, apis: RUNTIME_API_VERSIONS, }; diff --git a/substrate/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm b/substrate/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm index f601f830c1..e8aee63b4f 100644 Binary files a/substrate/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm and b/substrate/node/runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm differ