mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2024-12-27 22:37:25 +00:00
Updates for latest master
This commit is contained in:
parent
fc8dc6dfa7
commit
cf459b60a9
@ -23,19 +23,6 @@ pub struct ClientConfig {
|
||||
|
||||
impl Default for ClientConfig {
|
||||
fn default() -> Self {
|
||||
let data_dir = {
|
||||
let home = dirs::home_dir().expect("Unable to determine home dir.");
|
||||
home.join(".lighthouse/")
|
||||
};
|
||||
fs::create_dir_all(&data_dir)
|
||||
.unwrap_or_else(|_| panic!("Unable to create {:?}", &data_dir));
|
||||
|
||||
// currently lighthouse spec
|
||||
let default_spec = ChainSpec::lighthouse_testnet();
|
||||
let chain_type = ChainType::from(default_spec.chain_id);
|
||||
// builds a chain-specific network config
|
||||
let net_conf = NetworkConfig::from(chain_type);
|
||||
|
||||
Self {
|
||||
data_dir: PathBuf::from(".lighthouse"),
|
||||
db_type: "disk".to_string(),
|
||||
@ -50,13 +37,19 @@ impl Default for ClientConfig {
|
||||
}
|
||||
|
||||
impl ClientConfig {
|
||||
<<<<<<< HEAD
|
||||
/// Returns the path to which the client may initialize an on-disk database.
|
||||
pub fn db_path(&self) -> Option<PathBuf> {
|
||||
self.data_dir()
|
||||
.and_then(|path| Some(path.join(&self.db_name)))
|
||||
}
|
||||
|
||||
/// Returns the core path for the client.
|
||||
pub fn data_dir(&self) -> Option<PathBuf> {
|
||||
let path = dirs::home_dir()?.join(&self.data_dir);
|
||||
fs::create_dir_all(&path).ok()?;
|
||||
Some(path)
|
||||
}
|
||||
|
||||
/// Apply the following arguments to `self`, replacing values if they are specified in `args`.
|
||||
///
|
||||
/// Returns an error if arguments are obviously invalid. May succeed even if some values are
|
||||
@ -74,6 +67,6 @@ impl ClientConfig {
|
||||
self.rpc.apply_cli_args(args)?;
|
||||
self.http.apply_cli_args(args)?;
|
||||
|
||||
Ok(log)
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -7,15 +7,14 @@ edition = "2018"
|
||||
[dependencies]
|
||||
beacon_chain = { path = "../beacon_chain" }
|
||||
clap = "2.32.0"
|
||||
# SigP repository until PR is merged
|
||||
#libp2p = { git = "https://github.com/SigP/rust-libp2p", rev = "fb852bcc2b9b3935555cc93930e913cbec2b0688" }
|
||||
libp2p = { path = "../../../sharding/rust-libp2p" }
|
||||
# SigP repository
|
||||
libp2p = { git = "https://github.com/SigP/rust-libp2p", rev = "8d5e5bbbe32d07ad271d6a2e15fde0347894061a" }
|
||||
types = { path = "../../eth2/types" }
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
ssz = { path = "../../eth2/utils/ssz" }
|
||||
ssz_derive = { path = "../../eth2/utils/ssz_derive" }
|
||||
slog = { version = "^2.2.3" , features = ["max_level_trace", "release_max_level_trace"] }
|
||||
slog = { version = "2.4.1" , features = ["max_level_trace", "release_max_level_trace"] }
|
||||
version = { path = "../version" }
|
||||
tokio = "0.1.16"
|
||||
futures = "0.1.25"
|
||||
|
@ -147,11 +147,7 @@ impl<TSubstream: AsyncRead + AsyncWrite> Behaviour<TSubstream> {
|
||||
pub fn new(local_public_key: PublicKey, net_conf: &NetworkConfig, log: &slog::Logger) -> Self {
|
||||
let local_peer_id = local_public_key.clone().into_peer_id();
|
||||
let behaviour_log = log.new(o!());
|
||||
|
||||
// identify configuration
|
||||
let identify_config = net_conf.identify_config.clone();
|
||||
|
||||
// ping configuration
|
||||
let ping_config = PingConfig::new()
|
||||
.with_timeout(Duration::from_secs(30))
|
||||
.with_interval(Duration::from_secs(20))
|
||||
|
@ -522,30 +522,15 @@ impl<T: BeaconChainTypes> SimpleSync<T> {
|
||||
BlockProcessingOutcome::ParentUnknown { .. } => {
|
||||
self.import_queue
|
||||
.enqueue_full_blocks(vec![block], peer_id.clone());
|
||||
trace!(
|
||||
self.log,
|
||||
"NewGossipBlock";
|
||||
"peer" => format!("{:?}", peer_id),
|
||||
);
|
||||
trace!(
|
||||
self.log,
|
||||
"NewGossipBlock";
|
||||
"peer" => format!("{:?}", peer_id),
|
||||
);
|
||||
|
||||
// Ignore any block from a finalized slot.
|
||||
if self.slot_is_finalized(block.slot) {
|
||||
warn!(
|
||||
self.log, "NewGossipBlock";
|
||||
"msg" => "new block slot is finalized.",
|
||||
"block_slot" => block.slot,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
SHOULD_FORWARD_GOSSIP_BLOCK
|
||||
}
|
||||
|
||||
let block_root = Hash256::from_slice(&block.hash_tree_root());
|
||||
|
||||
// Ignore any block that the chain already knows about.
|
||||
if self.chain_has_seen_block(&block_root) {
|
||||
println!("this happened");
|
||||
// TODO: Age confirm that we shouldn't forward a block if we already know of it.
|
||||
return false;
|
||||
}
|
||||
BlockProcessingOutcome::FutureSlot {
|
||||
present_slot,
|
||||
block_slot,
|
||||
|
@ -107,6 +107,7 @@ pub struct ChainSpec {
|
||||
/*
|
||||
* Network specific parameters
|
||||
*/
|
||||
pub boot_nodes: Vec<Multiaddr>,
|
||||
pub chain_id: u8,
|
||||
}
|
||||
|
||||
@ -216,7 +217,8 @@ impl ChainSpec {
|
||||
/*
|
||||
* Network specific
|
||||
*/
|
||||
chain_id: 1, // foundation chain id
|
||||
boot_nodes: vec![],
|
||||
chain_id: 1, // mainnet chain id
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user