diff --git a/integration_test/tests/mining.rs b/integration_test/tests/mining.rs index 897018ab..bcc3bf66 100644 --- a/integration_test/tests/mining.rs +++ b/integration_test/tests/mining.rs @@ -39,19 +39,21 @@ fn mining__get_block_template__modelled() { #[test] fn mining__get_mining_info() { let node = Node::with_wallet(Wallet::Default, &[]); + node.fund_wallet(); let json: GetMiningInfo = node.client.get_mining_info().expect("rpc"); // Up to v28 (i.e., not 29_0) there is no error converting into model. #[cfg(feature = "v28_and_below")] - let _: mtype::GetMiningInfo = json.into_model(); + let model: mtype::GetMiningInfo = json.into_model(); - // v29 onwards #[cfg(not(feature = "v28_and_below"))] - { - let model: Result = json.into_model(); - model.unwrap(); - } + let model: mtype::GetMiningInfo = { + let result: Result = json.into_model(); + result.unwrap() + }; + + assert!(model.network_hash_ps > 0.0); } #[test] diff --git a/types/src/model/mining.rs b/types/src/model/mining.rs index 8d3bffcf..4b31d008 100644 --- a/types/src/model/mining.rs +++ b/types/src/model/mining.rs @@ -113,7 +113,7 @@ pub struct GetMiningInfo { /// The current target (v29 onwards). pub target: Option, /// The network hashes per second. - pub network_hash_ps: i64, + pub network_hash_ps: f64, /// The size of the mempool. pub pooled_tx: i64, /// Minimum feerate of packages selected for block inclusion. diff --git a/types/src/v17/mining/mod.rs b/types/src/v17/mining/mod.rs index a8f07fef..965cfcd2 100644 --- a/types/src/v17/mining/mod.rs +++ b/types/src/v17/mining/mod.rs @@ -157,7 +157,7 @@ pub struct GetMiningInfo { pub difficulty: f64, /// The network hashes per second. #[serde(rename = "networkhashps")] - pub network_hash_ps: i64, + pub network_hash_ps: f64, /// The size of the mempool. #[serde(rename = "pooledtx")] pub pooled_tx: i64, diff --git a/types/src/v28/mining.rs b/types/src/v28/mining.rs index 8bc949de..5deff4b8 100644 --- a/types/src/v28/mining.rs +++ b/types/src/v28/mining.rs @@ -29,7 +29,7 @@ pub struct GetMiningInfo { pub difficulty: f64, /// The network hashes per second. #[serde(rename = "networkhashps")] - pub network_hash_ps: i64, + pub network_hash_ps: f64, /// The size of the mempool. #[serde(rename = "pooledtx")] pub pooled_tx: i64, diff --git a/types/src/v29/mining/mod.rs b/types/src/v29/mining/mod.rs index ece4b9b3..e6d559eb 100644 --- a/types/src/v29/mining/mod.rs +++ b/types/src/v29/mining/mod.rs @@ -37,7 +37,7 @@ pub struct GetMiningInfo { pub target: String, /// The network hashes per second. #[serde(rename = "networkhashps")] - pub network_hash_ps: i64, + pub network_hash_ps: f64, /// The size of the mempool. #[serde(rename = "pooledtx")] pub pooled_tx: i64, diff --git a/types/src/v30/mining/mod.rs b/types/src/v30/mining/mod.rs index f9a53634..9e149471 100644 --- a/types/src/v30/mining/mod.rs +++ b/types/src/v30/mining/mod.rs @@ -38,7 +38,7 @@ pub struct GetMiningInfo { pub target: String, /// The network hashes per second. #[serde(rename = "networkhashps")] - pub network_hash_ps: i64, + pub network_hash_ps: f64, /// The size of the mempool. #[serde(rename = "pooledtx")] pub pooled_tx: i64,