diff --git a/network/src/consensus.rs b/network/src/consensus.rs index 0660b00b..48afe0ea 100644 --- a/network/src/consensus.rs +++ b/network/src/consensus.rs @@ -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 diff --git a/pbtc/config.rs b/pbtc/config.rs index e960cc5d..542a2061 100644 --- a/pbtc/config.rs +++ b/pbtc/config.rs @@ -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 { None => None, }; - let seednodes = match matches.value_of("seednode") { + let mut seednodes: Vec = 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 { 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())?, diff --git a/pbtc/seednodes.rs b/pbtc/seednodes.rs index 7aded9e8..92c1da75 100644 --- a/pbtc/seednodes.rs +++ b/pbtc/seednodes.rs @@ -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", + ] +}