diff --git a/core/src/genesis.rs b/core/src/genesis.rs index f981c59ff..710cd6845 100644 --- a/core/src/genesis.rs +++ b/core/src/genesis.rs @@ -74,9 +74,7 @@ pub fn genesis_testnet1() -> core::Block { } } -/// Second testnet genesis block (cuckoo30). TBD and don't start getting excited -/// just because you see this reference here... this is for testing mining -/// at cuckoo 30 +/// Second testnet genesis block (cuckoo30). pub fn genesis_testnet2() -> core::Block { core::Block { header: core::BlockHeader { @@ -107,6 +105,37 @@ pub fn genesis_testnet2() -> core::Block { } } +/// Second testnet genesis block (cuckoo30). Temporary values for now. +pub fn genesis_testnet3() -> core::Block { + core::Block { + header: core::BlockHeader { + height: 0, + previous: core::hash::Hash([0xff; 32]), + timestamp: time::Tm { + tm_year: 2018 - 1900, + tm_mon: 6, + tm_mday: 2, + tm_hour: 0, + ..time::empty_tm() + }, + total_difficulty: Difficulty::from_num(global::initial_block_difficulty()), + nonce: 1060, + pow: core::Proof::new(vec![ + 0x1940730, 0x333b9d0, 0x4739d6f, 0x4c6cfb1, 0x6e3d6c3, 0x74408a3, 0x7ba2bd2, + 0x83e2024, 0x8ca22b5, 0x9d39ab8, 0xb6646dd, 0xc6698b6, 0xc6f78fe, 0xc99b662, + 0xcf2ae8c, 0xcf41eed, 0xdd073e6, 0xded6af8, 0xf08d1a5, 0x1156a144, 0x11d1160a, + 0x131bb0a5, 0x137ad703, 0x13b0831f, 0x1421683f, 0x147e3c1f, 0x1496fda0, 0x150ba22b, + 0x15cc5bc6, 0x16edf697, 0x17ced40c, 0x17d84f9e, 0x18a515c1, 0x19320d9c, 0x19da4f6d, + 0x1b50bcb1, 0x1b8bc72f, 0x1c7b6964, 0x1d07b3a9, 0x1d189d4d, 0x1d1f9a15, 0x1dafcd41, + ]), + ..Default::default() + }, + inputs: vec![], + outputs: vec![], + kernels: vec![], + } +} + /// Placeholder for mainnet genesis block, will definitely change before /// release so no use trying to pre-mine it. pub fn genesis_main() -> core::Block { diff --git a/core/src/global.rs b/core/src/global.rs index 2614557d6..8144eab63 100644 --- a/core/src/global.rs +++ b/core/src/global.rs @@ -59,22 +59,24 @@ pub const TESTING_INITIAL_DIFFICULTY: u64 = 1; /// Testnet 2 initial block difficulty, high to see how it goes pub const TESTNET2_INITIAL_DIFFICULTY: u64 = 1000; +/// Testnet 2 initial block difficulty, moderatly hight, taking into account +/// a 30x Cuckoo adjustment factor +pub const TESTNET3_INITIAL_DIFFICULTY: u64 = 15000; + /// Types of chain a server can run with, dictates the genesis block and /// and mining parameters used. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub enum ChainTypes { /// For CI testing AutomatedTesting, - /// For User testing UserTesting, - /// First test network Testnet1, - /// Second test network Testnet2, - + /// Thirs test network + Testnet3, /// Main production network Mainnet, } @@ -105,6 +107,7 @@ pub fn min_sizeshift() -> u8 { ChainTypes::UserTesting => USER_TESTING_MIN_SIZESHIFT, ChainTypes::Testnet1 => USER_TESTING_MIN_SIZESHIFT, ChainTypes::Testnet2 => DEFAULT_MIN_SIZESHIFT, + ChainTypes::Testnet3 => DEFAULT_MIN_SIZESHIFT, ChainTypes::Mainnet => DEFAULT_MIN_SIZESHIFT, } } @@ -119,6 +122,7 @@ pub fn ref_sizeshift() -> u8 { ChainTypes::UserTesting => USER_TESTING_MIN_SIZESHIFT, ChainTypes::Testnet1 => USER_TESTING_MIN_SIZESHIFT, ChainTypes::Testnet2 => REFERENCE_SIZESHIFT, + ChainTypes::Testnet3 => REFERENCE_SIZESHIFT, ChainTypes::Mainnet => REFERENCE_SIZESHIFT, } } @@ -131,6 +135,7 @@ pub fn proofsize() -> usize { ChainTypes::UserTesting => USER_TESTING_PROOF_SIZE, ChainTypes::Testnet1 => PROOFSIZE, ChainTypes::Testnet2 => PROOFSIZE, + ChainTypes::Testnet3 => PROOFSIZE, ChainTypes::Mainnet => PROOFSIZE, } } @@ -143,6 +148,7 @@ pub fn coinbase_maturity() -> u64 { ChainTypes::UserTesting => USER_TESTING_COINBASE_MATURITY, ChainTypes::Testnet1 => COINBASE_MATURITY, ChainTypes::Testnet2 => COINBASE_MATURITY, + ChainTypes::Testnet3 => COINBASE_MATURITY, ChainTypes::Mainnet => COINBASE_MATURITY, } } @@ -155,6 +161,7 @@ pub fn initial_block_difficulty() -> u64 { ChainTypes::UserTesting => TESTING_INITIAL_DIFFICULTY, ChainTypes::Testnet1 => TESTING_INITIAL_DIFFICULTY, ChainTypes::Testnet2 => TESTNET2_INITIAL_DIFFICULTY, + ChainTypes::Testnet3 => TESTNET2_INITIAL_DIFFICULTY, ChainTypes::Mainnet => INITIAL_DIFFICULTY, } } @@ -167,6 +174,7 @@ pub fn cut_through_horizon() -> u32 { ChainTypes::UserTesting => TESTING_CUT_THROUGH_HORIZON, ChainTypes::Testnet1 => CUT_THROUGH_HORIZON, ChainTypes::Testnet2 => CUT_THROUGH_HORIZON, + ChainTypes::Testnet3 => CUT_THROUGH_HORIZON, ChainTypes::Mainnet => CUT_THROUGH_HORIZON, } } @@ -188,6 +196,7 @@ pub fn is_production_mode() -> bool { let param_ref = CHAIN_TYPE.read().unwrap(); ChainTypes::Testnet1 == *param_ref || ChainTypes::Testnet2 == *param_ref + || ChainTypes::Testnet3 == *param_ref || ChainTypes::Mainnet == *param_ref } diff --git a/servers/src/grin/server.rs b/servers/src/grin/server.rs index e96c3cb46..17cf02162 100644 --- a/servers/src/grin/server.rs +++ b/servers/src/grin/server.rs @@ -124,6 +124,7 @@ impl Server { let genesis = match config.chain_type { global::ChainTypes::Testnet1 => genesis::genesis_testnet1(), global::ChainTypes::Testnet2 => genesis::genesis_testnet2(), + global::ChainTypes::Testnet3 => genesis::genesis_testnet3(), global::ChainTypes::AutomatedTesting => genesis::genesis_dev(), global::ChainTypes::UserTesting => genesis::genesis_dev(), global::ChainTypes::Mainnet => genesis::genesis_testnet2(), //TODO: Fix, obviously