segwit2x: fork height + seednodes

This commit is contained in:
Svyatoslav Nikolsky 2017-08-22 12:56:39 +03:00
parent 4f9811fe6f
commit 42c6ca77f0
3 changed files with 16 additions and 3 deletions

View File

@ -3,7 +3,7 @@ use hash::H256;
use {Magic, Deployment};
/// First block of SegWit2x fork.
pub const SEGWIT2X_FORK_BLOCK: u32 = 0xFFFFFFFF; // not known (yet?)
pub const SEGWIT2X_FORK_BLOCK: u32 = 494784; // https://segwit2x.github.io/segwit2x-announce.html
/// First block of BitcoinCash fork.
pub const BITCOIN_CASH_FORK_BLOCK: u32 = 478559; // https://blockchair.com/bitcoin-cash/block/478559

View File

@ -3,7 +3,7 @@ use clap;
use message::Services;
use network::{Magic, ConsensusParams, ConsensusFork, SEGWIT2X_FORK_BLOCK, BITCOIN_CASH_FORK_BLOCK};
use p2p::InternetProtocol;
use seednodes::{mainnet_seednodes, testnet_seednodes};
use seednodes::{mainnet_seednodes, testnet_seednodes, segwit2x_seednodes};
use rpc_apis::ApiSet;
use {USER_AGENT, REGTEST_USER_AGENT};
use primitives::hash::H256;
@ -81,7 +81,7 @@ pub fn parse(matches: &clap::ArgMatches) -> Result<Config, String> {
None => None,
};
let seednodes = match matches.value_of("seednode") {
let mut seednodes: Vec<String> = match matches.value_of("seednode") {
Some(s) => vec![s.parse().map_err(|_| "Invalid seednode".to_owned())?],
None => match magic {
Magic::Mainnet => mainnet_seednodes().into_iter().map(Into::into).collect(),
@ -89,6 +89,10 @@ pub fn parse(matches: &clap::ArgMatches) -> Result<Config, String> {
Magic::Other(_) | Magic::Regtest | Magic::Unitest => Vec::new(),
},
};
match consensus_fork {
ConsensusFork::SegWit2x(_) => seednodes.extend(segwit2x_seednodes().into_iter().map(Into::into)),
_ => (),
}
let db_cache = match matches.value_of("db-cache") {
Some(s) => s.parse().map_err(|_| "Invalid cache size - should be number in MB".to_owned())?,

View File

@ -27,3 +27,12 @@ pub fn testnet_seednodes() -> Vec<&'static str> {
"testnet-seed.voskuil.org:18333",
]
}
pub fn segwit2x_seednodes() -> Vec<&'static str> {
vec![
"seed.mainnet.b-pay.net:8333",
"seed.ob1.io:8333",
"seed.blockchain.info:8333",
"bitcoin.bloqseeds.net:8333",
]
}