Ported acbe983 and 58d7dc7 from testnet1 branch
This commit is contained in:
@@ -21,7 +21,6 @@ use core::core::{self, Output};
|
||||
use core::core::block::BlockHeader;
|
||||
use core::core::hash::{Hash, Hashed};
|
||||
use core::core::target::Difficulty;
|
||||
use core::global;
|
||||
use p2p::{self, NetAdapter, PeerData, PeerStore, Server, State};
|
||||
use pool;
|
||||
use util::secp::pedersen::Commitment;
|
||||
@@ -286,11 +285,6 @@ impl NetToChainAdapter {
|
||||
} else {
|
||||
chain::NONE
|
||||
};
|
||||
let opts = if global::is_production_mode() {
|
||||
opts
|
||||
} else {
|
||||
opts | chain::EASY_POW
|
||||
};
|
||||
opts
|
||||
}
|
||||
}
|
||||
|
||||
+1
-6
@@ -507,12 +507,7 @@ impl Miner {
|
||||
b.hash()
|
||||
);
|
||||
b.header.pow = proof;
|
||||
let opts = if cuckoo_size < consensus::DEFAULT_SIZESHIFT as u32 {
|
||||
chain::EASY_POW
|
||||
} else {
|
||||
chain::NONE
|
||||
};
|
||||
let res = self.chain.process_block(b, opts);
|
||||
let res = self.chain.process_block(b, chain::NONE);
|
||||
if let Err(e) = res {
|
||||
error!(
|
||||
LOGGER,
|
||||
|
||||
+4
-2
@@ -35,7 +35,7 @@ use util::LOGGER;
|
||||
|
||||
const PEER_MAX_COUNT: u32 = 25;
|
||||
const PEER_PREFERRED_COUNT: u32 = 8;
|
||||
const SEEDS_URL: &'static str = "http://www.mimwim.org/seeds.txt";
|
||||
const SEEDS_URL: &'static str = "http://grin-tech.org/seeds.txt";
|
||||
|
||||
pub struct Seeder {
|
||||
peer_store: Arc<p2p::PeerStore>,
|
||||
@@ -158,7 +158,7 @@ impl Seeder {
|
||||
})
|
||||
.and_then(|mut peers| {
|
||||
// if so, get their addresses, otherwise use our seeds
|
||||
if peers.len() > 0 {
|
||||
if peers.len() > 3 {
|
||||
thread_rng().shuffle(&mut peers[..]);
|
||||
Box::new(future::ok(peers.iter().map(|p| p.addr).collect::<Vec<_>>()))
|
||||
} else {
|
||||
@@ -218,6 +218,7 @@ pub fn web_seeds(h: reactor::Handle) -> Box<Future<Item = Vec<SocketAddr>, Error
|
||||
let url = hyper::Uri::from_str(&SEEDS_URL).unwrap();
|
||||
let seeds = future::ok(()).and_then(move |_| {
|
||||
let client = hyper::Client::new(&h);
|
||||
debug!(LOGGER, "Retrieving seed nodes from {}", &SEEDS_URL);
|
||||
|
||||
// http get, filtering out non 200 results
|
||||
client
|
||||
@@ -241,6 +242,7 @@ pub fn web_seeds(h: reactor::Handle) -> Box<Future<Item = Vec<SocketAddr>, Error
|
||||
let addrs = res.split_whitespace()
|
||||
.map(|s| s.parse().unwrap())
|
||||
.collect::<Vec<_>>();
|
||||
debug!(LOGGER, "Retrieved seed addresses: {:?}", addrs);
|
||||
Ok(addrs)
|
||||
})
|
||||
})
|
||||
|
||||
+8
-1
@@ -81,6 +81,12 @@ pub enum Seeding {
|
||||
Programmatic,
|
||||
}
|
||||
|
||||
impl Default for Seeding {
|
||||
fn default() -> Seeding {
|
||||
Seeding::None
|
||||
}
|
||||
}
|
||||
|
||||
/// Full server configuration, aggregating configurations required for the
|
||||
/// different components.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
@@ -96,6 +102,7 @@ pub struct ServerConfig {
|
||||
pub chain_type: ChainTypes,
|
||||
|
||||
/// Method used to get the list of seed nodes for initial bootstrap.
|
||||
#[serde(default)]
|
||||
pub seeding_type: Seeding,
|
||||
|
||||
/// The list of seed nodes, if using Seeding as a seed type
|
||||
@@ -122,7 +129,7 @@ impl Default for ServerConfig {
|
||||
db_root: ".grin".to_string(),
|
||||
api_http_addr: "0.0.0.0:13413".to_string(),
|
||||
capabilities: p2p::FULL_NODE,
|
||||
seeding_type: Seeding::None,
|
||||
seeding_type: Seeding::default(),
|
||||
seeds: None,
|
||||
p2p_config: Some(p2p::P2PConfig::default()),
|
||||
mining_config: Some(pow::types::MinerConfig::default()),
|
||||
|
||||
Reference in New Issue
Block a user