mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
Add --staking flag (#1641)
## Issue Addressed Closes #1472 ## Proposed Changes Add `--staking` ~~and`staking-with-eth1-endpoint`~~ flag to improve UX for stakers. Co-authored-by: Paul Hauner <paul@paulhauner.com>
This commit is contained in:
@@ -55,6 +55,19 @@ impl FromStr for Eth1NetworkId {
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks that the provided eth1 node has all the relevant api endpoints open
|
||||
/// and returns the network id.
|
||||
pub async fn check_eth1_endpoint(
|
||||
endpoint: &str,
|
||||
timeout: Duration,
|
||||
) -> Result<Eth1NetworkId, String> {
|
||||
// Checks that the "eth" api works as expected.
|
||||
let _block_number = get_block_number(endpoint, timeout).await?;
|
||||
// Checks that the "net" api works as expected.
|
||||
let network_id = get_network_id(endpoint, timeout).await?;
|
||||
Ok(network_id)
|
||||
}
|
||||
|
||||
/// Get the eth1 network id of the given endpoint.
|
||||
pub async fn get_network_id(endpoint: &str, timeout: Duration) -> Result<Eth1NetworkId, String> {
|
||||
let response_body = send_rpc_request(endpoint, "net_version", json!([]), timeout).await?;
|
||||
|
||||
Reference in New Issue
Block a user