diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-09-22 20:35:19 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2015-09-27 22:46:13 +0100 |
commit | 198f557d38da3212fed1f12c0113bf2c4633ff44 (patch) | |
tree | fff32a2c0ba60f405f98e7eb3f8ef11c22ad067f /src/cryptonote_core/blockchain.cpp | |
parent | Merge pull request #405 (diff) | |
download | monero-198f557d38da3212fed1f12c0113bf2c4633ff44.tar.xz |
blockchain: use different hard fork settings for testnet and mainnet
Diffstat (limited to '')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 65d07dcf7..c6e9b7684 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -73,7 +73,7 @@ static const struct { uint8_t version; uint64_t height; time_t time; -} hard_forks[] = { +} mainnet_hard_forks[] = { // version 1 from the start of the blockchain { 1, 1, 1341378000 }, @@ -81,6 +81,15 @@ static const struct { { 2, 1009827, 1442763710 }, }; +static const struct { + uint8_t version; + uint64_t height; + time_t time; +} testnet_hard_forks[] = { + // version 1 from the start of the blockchain + { 1, 1, 1341378000 }, +}; + //------------------------------------------------------------------ Blockchain::Blockchain(tx_memory_pool& tx_pool) : m_db(), m_tx_pool(tx_pool), m_timestamps_and_difficulties_height(0), m_current_block_cumul_sz_limit(0), m_is_in_checkpoint_zone(false), @@ -288,8 +297,15 @@ bool Blockchain::init(BlockchainDB* db, const bool testnet) m_db = db; m_hardfork = new HardFork(*db); - for (size_t n = 0; n < sizeof(hard_forks) / sizeof(hard_forks[0]); ++n) - m_hardfork->add(hard_forks[n].version, hard_forks[n].height, hard_forks[n].time); + if (testnet) { + for (size_t n = 0; n < sizeof(testnet_hard_forks) / sizeof(testnet_hard_forks[0]); ++n) + m_hardfork->add(testnet_hard_forks[n].version, testnet_hard_forks[n].height, testnet_hard_forks[n].time); + } + else + { + for (size_t n = 0; n < sizeof(mainnet_hard_forks) / sizeof(mainnet_hard_forks[0]); ++n) + m_hardfork->add(mainnet_hard_forks[n].version, mainnet_hard_forks[n].height, mainnet_hard_forks[n].time); + } m_hardfork->init(); // if the blockchain is new, add the genesis block |