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:
Pawan Dhananjay
2020-09-23 01:19:58 +00:00
parent b75df29501
commit 80ecafaae4
5 changed files with 60 additions and 5 deletions

View File

@@ -599,8 +599,15 @@ where
.ok_or_else(|| "caching_eth1_backend requires a chain spec".to_string())?;
// Check if the eth1 endpoint we connect to is on the correct network id.
// Note: This check also effectively checks the eth1 http connection before the beacon chain
// is completely started and fails loudly if there is an issue.
let network_id =
eth1::http::get_network_id(&config.endpoint, Duration::from_millis(15_000)).await?;
eth1::http::check_eth1_endpoint(&config.endpoint, Duration::from_millis(15_000))
.await
.map_err(|_| "Error connecting to eth1 node.\n\
Please ensure that you have an eth1 http server running locally on localhost:8545 \
or pass an external endpoint using `--eth1-endpoint <SERVER-ADDRESS>`.\n\
Also ensure that `eth` and `net` apis are enabled on the eth1 http server.".to_string())?;
if network_id != config.network_id {
return Err(format!(