-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
404 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
zebra-rpc/src/methods/get_block_template_rpcs/types/get_mining_info.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
//! Response type for the `getmininginfo` RPC. | ||
use zebra_chain::parameters::Network; | ||
|
||
/// Response to a `getmininginfo` RPC request. | ||
#[derive(Debug, PartialEq, Eq, serde::Serialize)] | ||
pub struct Response { | ||
/// The estimated network solution rate in Sol/s. | ||
networksolps: u128, | ||
|
||
/// The estimated network solution rate in Sol/s. | ||
networkhashps: u128, | ||
|
||
/// Current network name as defined in BIP70 (main, test, regtest) | ||
chain: String, | ||
|
||
/// If using testnet or not | ||
testnet: bool, | ||
} | ||
|
||
impl Response { | ||
/// Creates a new `getmininginfo` response | ||
pub fn new(network: Network, networksolps: u128) -> Self { | ||
Self { | ||
networksolps, | ||
networkhashps: networksolps, | ||
chain: network.bip70_network_name(), | ||
testnet: network == Network::Testnet, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
zebra-rpc/src/methods/tests/snapshot/snapshots/get_mining_info@mainnet_10.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
source: zebra-rpc/src/methods/tests/snapshot/get_block_template_rpcs.rs | ||
expression: get_mining_info | ||
--- | ||
{ | ||
"networksolps": 2, | ||
"networkhashps": 2, | ||
"chain": "main", | ||
"testnet": false | ||
} |
10 changes: 10 additions & 0 deletions
10
zebra-rpc/src/methods/tests/snapshot/snapshots/get_mining_info@testnet_10.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
source: zebra-rpc/src/methods/tests/snapshot/get_block_template_rpcs.rs | ||
expression: get_mining_info | ||
--- | ||
{ | ||
"networksolps": 0, | ||
"networkhashps": 0, | ||
"chain": "test", | ||
"testnet": true | ||
} |
5 changes: 5 additions & 0 deletions
5
zebra-rpc/src/methods/tests/snapshot/snapshots/get_network_sol_ps@mainnet_10.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: zebra-rpc/src/methods/tests/snapshot/get_block_template_rpcs.rs | ||
expression: get_network_sol_ps | ||
--- | ||
2 |
5 changes: 5 additions & 0 deletions
5
zebra-rpc/src/methods/tests/snapshot/snapshots/get_network_sol_ps@testnet_10.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
source: zebra-rpc/src/methods/tests/snapshot/get_block_template_rpcs.rs | ||
expression: get_network_sol_ps | ||
--- | ||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.