mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 09:16:00 +00:00
Partially implement --terminal-block-hash-override
This commit is contained in:
@@ -150,12 +150,16 @@ where
|
|||||||
let terminal_total_difficulty = config
|
let terminal_total_difficulty = config
|
||||||
.terminal_total_difficulty_override
|
.terminal_total_difficulty_override
|
||||||
.unwrap_or(spec.terminal_total_difficulty);
|
.unwrap_or(spec.terminal_total_difficulty);
|
||||||
|
let terminal_block_hash = config
|
||||||
|
.terminal_block_hash
|
||||||
|
.unwrap_or(spec.terminal_block_hash);
|
||||||
|
|
||||||
let execution_layer = if let Some(execution_endpoints) = config.execution_endpoints {
|
let execution_layer = if let Some(execution_endpoints) = config.execution_endpoints {
|
||||||
let context = runtime_context.service_context("exec".into());
|
let context = runtime_context.service_context("exec".into());
|
||||||
let execution_layer = ExecutionLayer::from_urls(
|
let execution_layer = ExecutionLayer::from_urls(
|
||||||
execution_endpoints,
|
execution_endpoints,
|
||||||
terminal_total_difficulty,
|
terminal_total_difficulty,
|
||||||
|
terminal_block_hash,
|
||||||
config.fee_recipient,
|
config.fee_recipient,
|
||||||
context.executor.clone(),
|
context.executor.clone(),
|
||||||
context.log().clone(),
|
context.log().clone(),
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use sensitive_url::SensitiveUrl;
|
|||||||
use serde_derive::{Deserialize, Serialize};
|
use serde_derive::{Deserialize, Serialize};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use types::{Address, Graffiti, PublicKeyBytes, Uint256};
|
use types::{Address, Graffiti, Hash256, PublicKeyBytes, Uint256};
|
||||||
|
|
||||||
/// Default directory name for the freezer database under the top-level data dir.
|
/// Default directory name for the freezer database under the top-level data dir.
|
||||||
const DEFAULT_FREEZER_DB_DIR: &str = "freezer_db";
|
const DEFAULT_FREEZER_DB_DIR: &str = "freezer_db";
|
||||||
@@ -76,6 +76,7 @@ pub struct Config {
|
|||||||
pub eth1: eth1::Config,
|
pub eth1: eth1::Config,
|
||||||
pub execution_endpoints: Option<Vec<SensitiveUrl>>,
|
pub execution_endpoints: Option<Vec<SensitiveUrl>>,
|
||||||
pub terminal_total_difficulty_override: Option<Uint256>,
|
pub terminal_total_difficulty_override: Option<Uint256>,
|
||||||
|
pub terminal_block_hash: Option<Hash256>,
|
||||||
pub fee_recipient: Option<Address>,
|
pub fee_recipient: Option<Address>,
|
||||||
pub http_api: http_api::Config,
|
pub http_api: http_api::Config,
|
||||||
pub http_metrics: http_metrics::Config,
|
pub http_metrics: http_metrics::Config,
|
||||||
@@ -99,6 +100,7 @@ impl Default for Config {
|
|||||||
eth1: <_>::default(),
|
eth1: <_>::default(),
|
||||||
execution_endpoints: None,
|
execution_endpoints: None,
|
||||||
terminal_total_difficulty_override: None,
|
terminal_total_difficulty_override: None,
|
||||||
|
terminal_block_hash: None,
|
||||||
fee_recipient: None,
|
fee_recipient: None,
|
||||||
disabled_forks: Vec::new(),
|
disabled_forks: Vec::new(),
|
||||||
graffiti: Graffiti::default(),
|
graffiti: Graffiti::default(),
|
||||||
|
|||||||
@@ -376,8 +376,19 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> {
|
|||||||
.help("Used to coordinate manual overrides to the TERMINAL_TOTAL_DIFFICULTY parameter. \
|
.help("Used to coordinate manual overrides to the TERMINAL_TOTAL_DIFFICULTY parameter. \
|
||||||
This flag should only be used if the user has a clear understanding that \
|
This flag should only be used if the user has a clear understanding that \
|
||||||
the broad Ethereum community has elected to override the terminal difficulty. \
|
the broad Ethereum community has elected to override the terminal difficulty. \
|
||||||
Failure to do so will cause your node to experience a consensus failure. \
|
Incorrect use of this flag will cause your node to experience a consensus
|
||||||
Be extremely careful with the use of this flag.")
|
failure. Be extremely careful with this flag.")
|
||||||
|
.takes_value(true)
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("terminal-block-hash-override")
|
||||||
|
.long("terminal-block-hash-override")
|
||||||
|
.value_name("TERMINAL_BLOCK_HASH")
|
||||||
|
.help("Used to coordinate manual overrides to the TERMINAL_BLOCK_HASH parameter. \
|
||||||
|
This flag should only be used if the user has a clear understanding that \
|
||||||
|
the broad Ethereum community has elected to override the terminal PoW block. \
|
||||||
|
Incorrect use of this flag will cause your node to experience a consensus
|
||||||
|
failure. Be extremely careful with this flag.")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
|
|||||||
@@ -238,6 +238,8 @@ pub fn get_config<E: EthSpec>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
client_config.fee_recipient = clap_utils::parse_optional(cli_args, "fee-recipient")?;
|
client_config.fee_recipient = clap_utils::parse_optional(cli_args, "fee-recipient")?;
|
||||||
|
client_config.terminal_block_hash =
|
||||||
|
clap_utils::parse_optional(cli_args, "terminal-block-hash")?;
|
||||||
|
|
||||||
if let Some(freezer_dir) = cli_args.value_of("freezer-dir") {
|
if let Some(freezer_dir) = cli_args.value_of("freezer-dir") {
|
||||||
client_config.freezer_db_path = Some(PathBuf::from(freezer_dir));
|
client_config.freezer_db_path = Some(PathBuf::from(freezer_dir));
|
||||||
|
|||||||
Reference in New Issue
Block a user