From 270c995a4bc4a8f7193306137d629178d626958e Mon Sep 17 00:00:00 2001 From: Javier Smooth Date: Wed, 6 May 2015 00:12:31 -0700 Subject: [PATCH 01/10] integration test for hard fork 1 changes --- src/crypto/chacha8.h | 2 +- src/crypto/hash-ops.h | 4 +++- src/crypto/hash.h | 8 +++++-- src/crypto/slow-hash.c | 23 +++++++++---------- src/cryptonote_config.h | 14 +++++++---- src/cryptonote_core/blockchain_storage.cpp | 5 ++-- src/cryptonote_core/checkpoints_create.h | 2 ++ .../cryptonote_format_utils.cpp | 4 ++-- src/cryptonote_core/difficulty.cpp | 20 +++++++++++----- src/cryptonote_core/difficulty.h | 4 ++-- .../cryptonote_protocol_handler.inl | 3 ++- src/miner/simpleminer.cpp | 5 +++- src/miner/simpleminer.h | 2 ++ src/p2p/net_node.inl | 4 ++-- tests/hash/main.cpp | 3 ++- tests/performance_tests/cn_slow_hash.h | 2 +- 16 files changed, 67 insertions(+), 38 deletions(-) diff --git a/src/crypto/chacha8.h b/src/crypto/chacha8.h index f098620..cf07c6e 100644 --- a/src/crypto/chacha8.h +++ b/src/crypto/chacha8.h @@ -73,7 +73,7 @@ namespace crypto { inline void generate_chacha8_key(std::string password, chacha8_key& key) { static_assert(sizeof(chacha8_key) <= sizeof(hash), "Size of hash must be at least that of chacha8_key"); char pwd_hash[HASH_SIZE]; - crypto::cn_slow_hash(password.data(), password.size(), pwd_hash); + crypto::cn_slow_hash_2m(password.data(), password.size(), pwd_hash); memcpy(&key, pwd_hash, sizeof(key)); memset(pwd_hash, 0, sizeof(pwd_hash)); } diff --git a/src/crypto/hash-ops.h b/src/crypto/hash-ops.h index f779314..ab2ca1a 100644 --- a/src/crypto/hash-ops.h +++ b/src/crypto/hash-ops.h @@ -79,7 +79,9 @@ enum { }; void cn_fast_hash(const void *data, size_t length, char *hash); -void cn_slow_hash(const void *data, size_t length, char *hash); +void cn_slow_hash(const void *data, size_t length, char *hash, int light); +inline void cn_slow_hash_1m(const void *data, size_t length, char *hash) { cn_slow_hash(data,length,hash,1); } +inline void cn_slow_hash_2m(const void *data, size_t length, char *hash) { cn_slow_hash(data,length,hash,0); } void hash_extra_blake(const void *data, size_t length, char *hash); void hash_extra_groestl(const void *data, size_t length, char *hash); diff --git a/src/crypto/hash.h b/src/crypto/hash.h index 0cade64..ee1268d 100644 --- a/src/crypto/hash.h +++ b/src/crypto/hash.h @@ -63,8 +63,12 @@ namespace crypto { return h; } - inline void cn_slow_hash(const void *data, std::size_t length, hash &hash) { - cn_slow_hash(data, length, reinterpret_cast(&hash)); + inline void cn_slow_hash(const void *data, std::size_t length, hash &hash, int light) { + cn_slow_hash(data, length, reinterpret_cast(&hash), light); + } + + inline void cn_slow_hash_2m(const void *data, std::size_t length, hash &hash) { + cn_slow_hash(data, length, hash, 0); } inline void tree_hash(const hash *hashes, std::size_t count, hash &root_hash) { diff --git a/src/crypto/slow-hash.c b/src/crypto/slow-hash.c index af15170..24615b9 100644 --- a/src/crypto/slow-hash.c +++ b/src/crypto/slow-hash.c @@ -76,7 +76,7 @@ #define U64(x) ((uint64_t *) (x)) #define R128(x) ((__m128i *) (x)) -#define state_index(x) (((*((uint64_t *)x) >> 4) & (TOTALBLOCKS - 1)) << 4) +#define state_index(x,div) (((*((uint64_t *)x) >> 4) & (TOTALBLOCKS /(div) - 1)) << 4) #if defined(_MSC_VER) #if !defined(_WIN64) #define __mul() lo = mul128(c[0], b[0], &hi); @@ -92,7 +92,7 @@ #endif #define pre_aes() \ - j = state_index(a); \ + j = state_index(a,(light?2:1)); \ _c = _mm_load_si128(R128(&hp_state[j])); \ _a = _mm_load_si128(R128(a)); \ @@ -101,7 +101,7 @@ _mm_store_si128(R128(c), _c); \ _b = _mm_xor_si128(_b, _c); \ _mm_store_si128(R128(&hp_state[j]), _b); \ - j = state_index(c); \ + j = state_index(c,(light?2:1)); \ p = U64(&hp_state[j]); \ b[0] = p[0]; b[1] = p[1]; \ __mul(); \ @@ -321,7 +321,6 @@ BOOL SetLockPagesPrivilege(HANDLE hProcess, BOOL bEnable) void slow_hash_allocate_state(void) { - int state = 0; if(hp_state != NULL) return; @@ -368,7 +367,7 @@ void slow_hash_free_state(void) hp_allocated = 0; } -void cn_slow_hash(const void *data, size_t length, char *hash) +void cn_slow_hash(const void *data, size_t length, char *hash, int light) { RDATA_ALIGN16 uint8_t expandedKey[240]; @@ -392,7 +391,7 @@ void cn_slow_hash(const void *data, size_t length, char *hash) // this isn't supposed to happen, but guard against it for now. if(hp_state == NULL) - slow_hash_allocate_state(); + slow_hash_allocate_state(); hash_process(&state.hs, data, length); memcpy(text, state.init, INIT_SIZE_BYTE); @@ -400,7 +399,7 @@ void cn_slow_hash(const void *data, size_t length, char *hash) if(useAes) { aes_expand_key(state.hs.b, expandedKey); - for(i = 0; i < MEMORY / INIT_SIZE_BYTE; i++) + for(i = 0; i < MEMORY / (light?2:1) / INIT_SIZE_BYTE; i++) { aes_pseudo_round(text, text, expandedKey, INIT_SIZE_BLK); memcpy(&hp_state[i * INIT_SIZE_BYTE], text, INIT_SIZE_BYTE); @@ -410,7 +409,7 @@ void cn_slow_hash(const void *data, size_t length, char *hash) { aes_ctx = (oaes_ctx *) oaes_alloc(); oaes_key_import_data(aes_ctx, state.hs.b, AES_KEY_SIZE); - for(i = 0; i < MEMORY / INIT_SIZE_BYTE; i++) + for(i = 0; i < MEMORY / (light?2:1) / INIT_SIZE_BYTE; i++) { for(j = 0; j < INIT_SIZE_BLK; j++) aesb_pseudo_round(&text[AES_BLOCK_SIZE * j], &text[AES_BLOCK_SIZE * j], aes_ctx->key->exp_data); @@ -428,7 +427,7 @@ void cn_slow_hash(const void *data, size_t length, char *hash) // this is ugly but the branching affects the loop somewhat so put it outside. if(useAes) { - for(i = 0; i < ITER / 2; i++) + for(i = 0; i < ITER / (light?2:1) / 2; i++) { pre_aes(); _c = _mm_aesenc_si128(_c, _a); @@ -438,7 +437,7 @@ void cn_slow_hash(const void *data, size_t length, char *hash) } else { - for(i = 0; i < ITER / 2; i++) + for(i = 0; i < ITER / (light?2:1) / 2; i++) { pre_aes(); aesb_single_round((uint8_t *) &_c, (uint8_t *) &_c, (uint8_t *) &_a); @@ -450,7 +449,7 @@ void cn_slow_hash(const void *data, size_t length, char *hash) if(useAes) { aes_expand_key(&state.hs.b[32], expandedKey); - for(i = 0; i < MEMORY / INIT_SIZE_BYTE; i++) + for(i = 0; i < MEMORY / (light?2:1) / INIT_SIZE_BYTE; i++) { // add the xor to the pseudo round aes_pseudo_round_xor(text, text, expandedKey, &hp_state[i * INIT_SIZE_BYTE], INIT_SIZE_BLK); @@ -459,7 +458,7 @@ void cn_slow_hash(const void *data, size_t length, char *hash) else { oaes_key_import_data(aes_ctx, &state.hs.b[32], AES_KEY_SIZE); - for(i = 0; i < MEMORY / INIT_SIZE_BYTE; i++) + for(i = 0; i < MEMORY / (light?2:1) / INIT_SIZE_BYTE; i++) { for(j = 0; j < INIT_SIZE_BLK; j++) { diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index e39c21f..e1571ee 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -30,6 +30,12 @@ #pragma once +#define HARDFORK_1_HEIGHT 1000 +#define HARDFORK_1_OLD_TARGET 1 +#define HARDFORK_1_POW_SPEED_MULTIPLIER 2 +#define HARDFORK_1_DIFFADJ HARDFORK_1_POW_SPEED_MULTIPLIER +#define HARDFORK_1_DIFFADJ_WINDOW 360 + #define CRYPTONOTE_MAX_BLOCK_NUMBER 500000000 #define CRYPTONOTE_MAX_BLOCK_SIZE 500000000 // block header blob limit, never used! #define CRYPTONOTE_GETBLOCKTEMPLATE_MAX_BLOCK_SIZE 196608 //size of block (bytes) that is the maximum that miners will produce @@ -60,7 +66,7 @@ #define ORPHANED_BLOCKS_MAX_COUNT 100 -#define DIFFICULTY_TARGET 60 // seconds +#define DIFFICULTY_TARGET 4 // seconds #define DIFFICULTY_WINDOW 720 // blocks #define DIFFICULTY_LAG 15 // !!! #define DIFFICULTY_CUT 60 // timestamps to cut after sorting @@ -81,8 +87,8 @@ #define CRYPTONOTE_MEMPOOL_TX_LIVETIME 86400 //seconds, one day #define CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME 604800 //seconds, one week -#define P2P_DEFAULT_PORT 11180 -#define RPC_DEFAULT_PORT 11181 +#define P2P_DEFAULT_PORT 31180 +#define RPC_DEFAULT_PORT 31181 #define COMMAND_RPC_GET_BLOCKS_FAST_MAX_COUNT 1000 #define P2P_LOCAL_WHITE_PEERLIST_LIMIT 1000 @@ -101,7 +107,7 @@ #define ALLOW_DEBUG_COMMANDS -#define CRYPTONOTE_NAME "aeon" +#define CRYPTONOTE_NAME "aeone" #define CRYPTONOTE_POOLDATA_FILENAME "poolstate.bin" #define CRYPTONOTE_BLOCKCHAINDATA_FILENAME "blockchain.bin" #define CRYPTONOTE_BLOCKCHAINDATA_TEMP_FILENAME "blockchain.bin.tmp" diff --git a/src/cryptonote_core/blockchain_storage.cpp b/src/cryptonote_core/blockchain_storage.cpp index 9b80b85..90136d8 100644 --- a/src/cryptonote_core/blockchain_storage.cpp +++ b/src/cryptonote_core/blockchain_storage.cpp @@ -373,7 +373,7 @@ difficulty_type blockchain_storage::get_difficulty_for_next_block() timestamps.push_back(m_blocks[offset].bl.timestamp); commulative_difficulties.push_back(m_blocks[offset].cumulative_difficulty); } - return next_difficulty(timestamps, commulative_difficulties); + return next_difficulty(timestamps, commulative_difficulties,m_blocks.size()); } //------------------------------------------------------------------ bool blockchain_storage::rollback_blockchain_switching(std::list& original_chain, size_t rollback_height) @@ -507,7 +507,7 @@ difficulty_type blockchain_storage::get_next_difficulty_for_alternative_chain(co break; } } - return next_difficulty(timestamps, commulative_difficulties); + return next_difficulty(timestamps, commulative_difficulties,bei.height); } //------------------------------------------------------------------ bool blockchain_storage::prevalidate_miner_transaction(const block& b, uint64_t height) @@ -1551,6 +1551,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt if(!check_hash(proof_of_work, current_diffic)) { LOG_PRINT_L0("Block with id: " << id << ENDL + << "height: " << m_blocks.size() << ENDL << "have not enough proof of work: " << proof_of_work << ENDL << "nexpected difficulty: " << current_diffic ); bvc.m_verifivation_failed = true; diff --git a/src/cryptonote_core/checkpoints_create.h b/src/cryptonote_core/checkpoints_create.h index 19ed135..e6b5b1d 100644 --- a/src/cryptonote_core/checkpoints_create.h +++ b/src/cryptonote_core/checkpoints_create.h @@ -38,6 +38,7 @@ namespace cryptonote { inline bool create_checkpoints(cryptonote::checkpoints& checkpoints) { +#if 0 ADD_CHECKPOINT(1, "1440a20f078bf3264822234b347f8382606577d73d4e9d3cb7296d73889bc421"); ADD_CHECKPOINT(100, "6dd13aaab16679f49ee6b2b75c7dc99b1fd09ab2282b18cb4b55b73110655742"); ADD_CHECKPOINT(1000, "bc6458452fd0575a314089bf302f6fd68ebaa2d689c42f3365293b96bbdf1f25"); @@ -45,6 +46,7 @@ namespace cryptonote { ADD_CHECKPOINT(15000, "15567af42afc1ed00538f53b5e3822d421e3ed6372ca79f4ea4e3e3bab709a87"); ADD_CHECKPOINT(175500, "3f7dd748b3b863b04654d87a387f2b65a365f467188971f3192eab2368e64a35"); +#endif return true; } } diff --git a/src/cryptonote_core/cryptonote_format_utils.cpp b/src/cryptonote_core/cryptonote_format_utils.cpp index ba8ec7c..d1f65db 100644 --- a/src/cryptonote_core/cryptonote_format_utils.cpp +++ b/src/cryptonote_core/cryptonote_format_utils.cpp @@ -667,9 +667,9 @@ namespace cryptonote //--------------------------------------------------------------- bool get_block_longhash(const block& b, crypto::hash& res, uint64_t height) { - block b_local = b; //workaround to avoid const errors with do_serialize + //block b_local = b; //workaround to avoid const errors with do_serialize blobdata bd = get_block_hashing_blob(b); - crypto::cn_slow_hash(bd.data(), bd.size(), res); + crypto::cn_slow_hash(bd.data(), bd.size(), res, height >= HARDFORK_1_HEIGHT); return true; } //--------------------------------------------------------------- diff --git a/src/cryptonote_core/difficulty.cpp b/src/cryptonote_core/difficulty.cpp index 9c0e530..389112c 100644 --- a/src/cryptonote_core/difficulty.cpp +++ b/src/cryptonote_core/difficulty.cpp @@ -89,7 +89,12 @@ namespace cryptonote { return !carry; } - difficulty_type next_difficulty(vector timestamps, vector cumulative_difficulties, size_t target_seconds) { + difficulty_type next_difficulty(vector timestamps, vector cumulative_difficulties, size_t height) { + size_t target_seconds = DIFFICULTY_TARGET; + + if (height < HARDFORK_1_HEIGHT) + target_seconds = HARDFORK_1_OLD_TARGET; + //cutoff DIFFICULTY_LAG if(timestamps.size() > DIFFICULTY_WINDOW) { @@ -127,11 +132,14 @@ namespace cryptonote { if (high != 0 || low + time_span - 1 < low) { return 0; } - return (low + time_span - 1) / time_span; + + difficulty_type new_diff = (low + time_span - 1) / time_span; + + if (height >= HARDFORK_1_HEIGHT && height < HARDFORK_1_HEIGHT+HARDFORK_1_DIFFADJ_WINDOW) { + new_diff += new_diff*(HARDFORK_1_HEIGHT+HARDFORK_1_DIFFADJ_WINDOW-height)*(HARDFORK_1_DIFFADJ-1)/HARDFORK_1_DIFFADJ_WINDOW; + } + + return new_diff; } - difficulty_type next_difficulty(vector timestamps, vector cumulative_difficulties) - { - return next_difficulty(std::move(timestamps), std::move(cumulative_difficulties), DIFFICULTY_TARGET); - } } diff --git a/src/cryptonote_core/difficulty.h b/src/cryptonote_core/difficulty.h index f707173..326eabf 100644 --- a/src/cryptonote_core/difficulty.h +++ b/src/cryptonote_core/difficulty.h @@ -40,6 +40,6 @@ namespace cryptonote typedef std::uint64_t difficulty_type; bool check_hash(const crypto::hash &hash, difficulty_type difficulty); - difficulty_type next_difficulty(std::vector timestamps, std::vector cumulative_difficulties); - difficulty_type next_difficulty(std::vector timestamps, std::vector cumulative_difficulties, size_t target_seconds); + // difficulty_type next_difficulty(std::vector timestamps, std::vector cumulative_difficulties); + difficulty_type next_difficulty(std::vector timestamps, std::vector cumulative_difficulties, size_t height); } diff --git a/src/cryptonote_protocol/cryptonote_protocol_handler.inl b/src/cryptonote_protocol/cryptonote_protocol_handler.inl index 9460ff9..107613c 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_handler.inl +++ b/src/cryptonote_protocol/cryptonote_protocol_handler.inl @@ -30,6 +30,7 @@ #include #include +#include #include "cryptonote_core/cryptonote_format_utils.h" #include "profile_tools.h" @@ -182,7 +183,7 @@ namespace cryptonote int64_t diff = static_cast(hshd.current_height) - static_cast(m_core.get_current_blockchain_height()); LOG_PRINT_CCONTEXT_YELLOW("Sync data returned unknown top block: " << m_core.get_current_blockchain_height() << " -> " << hshd.current_height - << " [" << std::abs(diff) << " blocks (" << diff / (24 * 60 * 60 / DIFFICULTY_TARGET) << " days) " + << " [" << std::abs(diff) << " blocks (" << (std::min(m_core.get_current_blockchain_height(),hshd.current_height) < HARDFORK_1_HEIGHT ? std::to_string(diff) + " blocks) " : std::to_string(diff / (24 * 60 * 60 / DIFFICULTY_TARGET)) +" days) ") << (0 <= diff ? std::string("behind") : std::string("ahead")) << "] " << ENDL << "SYNCHRONIZATION started", (is_inital ? LOG_LEVEL_0:LOG_LEVEL_1)); LOG_PRINT_L1("Remote top block height: " << hshd.current_height << ", id: " << hshd.top_id); diff --git a/src/miner/simpleminer.cpp b/src/miner/simpleminer.cpp index 234a49e..a333614 100644 --- a/src/miner/simpleminer.cpp +++ b/src/miner/simpleminer.cpp @@ -90,6 +90,7 @@ namespace mining const command_line::arg_descriptor arg_pool_addr = {"pool-addr", ""}; const command_line::arg_descriptor arg_login = {"login", ""}; const command_line::arg_descriptor arg_pass = {"pass", ""}; + const command_line::arg_descriptor arg_lite = {"lite", ""}; //----------------------------------------------------------------------------------------------------- void simpleminer::init_options(boost::program_options::options_description& desc) @@ -97,6 +98,7 @@ namespace mining command_line::add_arg(desc, arg_pool_addr); command_line::add_arg(desc, arg_login); command_line::add_arg(desc, arg_pass); + command_line::add_arg(desc, arg_lite); } bool simpleminer::init(const boost::program_options::variables_map& vm) { @@ -108,6 +110,7 @@ namespace mining m_pool_port = pool_addr.substr(p + 1, pool_addr.size()); m_login = command_line::get_arg(vm, arg_login); m_pass = command_line::get_arg(vm, arg_pass); + m_cryptonight_lite = command_line::get_arg(vm, arg_lite); return true; } @@ -183,7 +186,7 @@ namespace mining //uint32_t c = (*((uint32_t*)&job.blob.data()[39])); ++(*((uint32_t*)&job.blob.data()[39])); crypto::hash h = cryptonote::null_hash; - crypto::cn_slow_hash(job.blob.data(), job.blob.size(), h); + crypto::cn_slow_hash(job.blob.data(), job.blob.size(), h, m_cryptonight_lite); if( ((uint32_t*)&h)[7] < job.target ) { //found! diff --git a/src/miner/simpleminer.h b/src/miner/simpleminer.h index 876934d..61ed7c6 100644 --- a/src/miner/simpleminer.h +++ b/src/miner/simpleminer.h @@ -54,6 +54,8 @@ namespace mining std::string m_pool_port; std::string m_login; std::string m_pass; + bool m_cryptonight_lite; + epee::net_utils::http::http_simple_client m_http_client; }; } diff --git a/src/p2p/net_node.inl b/src/p2p/net_node.inl index d4496ac..2b0fba0 100644 --- a/src/p2p/net_node.inl +++ b/src/p2p/net_node.inl @@ -533,14 +533,14 @@ namespace nodetool if (priority) {\ LOG_PRINT_CC_L0(con, msg); \ } else {\ - LOG_PRINT_CC_L1(con, msg); \ + LOG_PRINT_CC_L2(con, msg); \ } \ } while(0) template bool node_server::try_to_connect_and_handshake_with_new_peer(const net_address& na, bool just_take_peerlist, uint64_t last_seen_stamp, bool white) { - LOG_PRINT_L1("Connecting to " << epee::string_tools::get_ip_string_from_int32(na.ip) << ":" + LOG_PRINT_L2("Connecting to " << epee::string_tools::get_ip_string_from_int32(na.ip) << ":" << epee::string_tools::num_to_string_fast(na.port) << "(white=" << white << ", last_seen: " << (last_seen_stamp ? epee::misc_utils::get_time_interval_string(time(NULL) - last_seen_stamp):"never") << ")..."); diff --git a/tests/hash/main.cpp b/tests/hash/main.cpp index 57a502b..58935f6 100644 --- a/tests/hash/main.cpp +++ b/tests/hash/main.cpp @@ -58,7 +58,8 @@ extern "C" typedef void hash_f(const void *, size_t, char *); struct hash_func { const string name; hash_f &f; -} hashes[] = {{"fast", cn_fast_hash}, {"slow", cn_slow_hash}, {"tree", hash_tree}, +} hashes[] = {{"fast", cn_fast_hash}, {"slow-2m", cn_slow_hash_2m}, {"slow-1m", cn_slow_hash_1m}, + {"tree", hash_tree}, {"extra-blake", hash_extra_blake}, {"extra-groestl", hash_extra_groestl}, {"extra-jh", hash_extra_jh}, {"extra-skein", hash_extra_skein}}; diff --git a/tests/performance_tests/cn_slow_hash.h b/tests/performance_tests/cn_slow_hash.h index c7b467e..264ea93 100644 --- a/tests/performance_tests/cn_slow_hash.h +++ b/tests/performance_tests/cn_slow_hash.h @@ -61,7 +61,7 @@ public: bool test() { crypto::hash hash; - crypto::cn_slow_hash(&m_data, sizeof(m_data), hash); + crypto::cn_slow_hash_2m(&m_data, sizeof(m_data), hash); return hash == m_expected_hash; } From 6c658b4ed28741de8264b76baee7cfd8ce08c9d6 Mon Sep 17 00:00:00 2001 From: Javier Smooth Date: Sat, 9 May 2015 03:21:59 -0700 Subject: [PATCH 02/10] properly scale block reward for block target --- src/cryptonote_config.h | 3 ++- src/cryptonote_core/blockchain_storage.cpp | 6 +++--- src/cryptonote_core/blockchain_storage.h | 2 +- src/cryptonote_core/cryptonote_basic_impl.cpp | 5 +++-- src/cryptonote_core/cryptonote_basic_impl.h | 2 +- src/cryptonote_core/cryptonote_format_utils.cpp | 2 +- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index e1571ee..57cfccc 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -32,6 +32,7 @@ #define HARDFORK_1_HEIGHT 1000 #define HARDFORK_1_OLD_TARGET 1 +#define HARDFORK_1_OLD_SPEED_FACTOR (20) #define HARDFORK_1_POW_SPEED_MULTIPLIER 2 #define HARDFORK_1_DIFFADJ HARDFORK_1_POW_SPEED_MULTIPLIER #define HARDFORK_1_DIFFADJ_WINDOW 360 @@ -52,7 +53,7 @@ // MONEY_SUPPLY - total number coins to be generated #define MONEY_SUPPLY ((uint64_t)(-1)) -#define EMISSION_SPEED_FACTOR (20) +#define EMISSION_SPEED_FACTOR (18) #define CRYPTONOTE_REWARD_BLOCKS_WINDOW 100 #define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE 20000 //size of block (bytes) after which reward for block calculated using block size diff --git a/src/cryptonote_core/blockchain_storage.cpp b/src/cryptonote_core/blockchain_storage.cpp index 90136d8..a5d7eaa 100644 --- a/src/cryptonote_core/blockchain_storage.cpp +++ b/src/cryptonote_core/blockchain_storage.cpp @@ -533,7 +533,7 @@ bool blockchain_storage::prevalidate_miner_transaction(const block& b, uint64_t return true; } //------------------------------------------------------------------ -bool blockchain_storage::validate_miner_transaction(const block& b, size_t cumulative_block_size, uint64_t fee, uint64_t& base_reward, uint64_t already_generated_coins) +bool blockchain_storage::validate_miner_transaction(const block& b, size_t cumulative_block_size, uint64_t fee, uint64_t& base_reward, uint64_t already_generated_coins, size_t height) { //validate reward uint64_t money_in_use = 0; @@ -542,7 +542,7 @@ bool blockchain_storage::validate_miner_transaction(const block& b, size_t cumul std::vector last_blocks_sizes; get_last_n_blocks_sizes(last_blocks_sizes, CRYPTONOTE_REWARD_BLOCKS_WINDOW); - if (!get_block_reward(epee::misc_utils::median(last_blocks_sizes), cumulative_block_size, already_generated_coins, base_reward)) { + if (!get_block_reward(epee::misc_utils::median(last_blocks_sizes), cumulative_block_size, already_generated_coins, base_reward, height)) { LOG_PRINT_L0("block size " << cumulative_block_size << " is bigger than allowed for this blockchain"); return false; } @@ -1632,7 +1632,7 @@ bool blockchain_storage::handle_block_to_main_chain(const block& bl, const crypt } uint64_t base_reward = 0; uint64_t already_generated_coins = m_blocks.size() ? m_blocks.back().already_generated_coins:0; - if(!validate_miner_transaction(bl, cumulative_block_size, fee_summary, base_reward, already_generated_coins)) + if(!validate_miner_transaction(bl, cumulative_block_size, fee_summary, base_reward, already_generated_coins, get_current_blockchain_height())) { LOG_PRINT_L0("Block with id: " << id << " have wrong miner transaction"); diff --git a/src/cryptonote_core/blockchain_storage.h b/src/cryptonote_core/blockchain_storage.h index 2266561..08fc90e 100644 --- a/src/cryptonote_core/blockchain_storage.h +++ b/src/cryptonote_core/blockchain_storage.h @@ -225,7 +225,7 @@ namespace cryptonote bool handle_alternative_block(const block& b, const crypto::hash& id, block_verification_context& bvc); difficulty_type get_next_difficulty_for_alternative_chain(const std::list& alt_chain, block_extended_info& bei); bool prevalidate_miner_transaction(const block& b, uint64_t height); - bool validate_miner_transaction(const block& b, size_t cumulative_block_size, uint64_t fee, uint64_t& base_reward, uint64_t already_generated_coins); + bool validate_miner_transaction(const block& b, size_t cumulative_block_size, uint64_t fee, uint64_t& base_reward, uint64_t already_generated_coins, size_t height); bool validate_transaction(const block& b, uint64_t height, const transaction& tx); bool rollback_blockchain_switching(std::list& original_chain, size_t rollback_height); bool add_transaction_from_block(const transaction& tx, const crypto::hash& tx_id, const crypto::hash& bl_id, uint64_t bl_height); diff --git a/src/cryptonote_core/cryptonote_basic_impl.cpp b/src/cryptonote_core/cryptonote_basic_impl.cpp index 090e6a7..2d445c8 100644 --- a/src/cryptonote_core/cryptonote_basic_impl.cpp +++ b/src/cryptonote_core/cryptonote_basic_impl.cpp @@ -58,8 +58,9 @@ namespace cryptonote { return CRYPTONOTE_MAX_TX_SIZE; } //----------------------------------------------------------------------------------------------- - bool get_block_reward(size_t median_size, size_t current_block_size, uint64_t already_generated_coins, uint64_t &reward) { - uint64_t base_reward = (MONEY_SUPPLY - already_generated_coins) >> EMISSION_SPEED_FACTOR; + bool get_block_reward(size_t median_size, size_t current_block_size, uint64_t already_generated_coins, uint64_t &reward, size_t height) { + int speed = height < HARDFORK_1_HEIGHT ? HARDFORK_1_OLD_SPEED_FACTOR : EMISSION_SPEED_FACTOR; + uint64_t base_reward = (MONEY_SUPPLY - already_generated_coins) >> speed; //make it soft if (median_size < CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE) { diff --git a/src/cryptonote_core/cryptonote_basic_impl.h b/src/cryptonote_core/cryptonote_basic_impl.h index 743d15a..650eac3 100644 --- a/src/cryptonote_core/cryptonote_basic_impl.h +++ b/src/cryptonote_core/cryptonote_basic_impl.h @@ -64,7 +64,7 @@ namespace cryptonote { /************************************************************************/ size_t get_max_block_size(); size_t get_max_tx_size(); - bool get_block_reward(size_t median_size, size_t current_block_size, uint64_t already_generated_coins, uint64_t &reward); + bool get_block_reward(size_t median_size, size_t current_block_size, uint64_t already_generated_coins, uint64_t &reward, size_t height); uint8_t get_account_address_checksum(const public_address_outer_blob& bl); std::string get_account_address_as_str(const account_public_address& adr); bool get_account_address_from_str(account_public_address& adr, const std::string& str); diff --git a/src/cryptonote_core/cryptonote_format_utils.cpp b/src/cryptonote_core/cryptonote_format_utils.cpp index d1f65db..3750750 100644 --- a/src/cryptonote_core/cryptonote_format_utils.cpp +++ b/src/cryptonote_core/cryptonote_format_utils.cpp @@ -95,7 +95,7 @@ namespace cryptonote in.height = height; uint64_t block_reward; - if(!get_block_reward(median_size, current_block_size, already_generated_coins, block_reward)) + if(!get_block_reward(median_size, current_block_size, already_generated_coins, block_reward, height)) { LOG_PRINT_L0("Block is too big"); return false; From 2ea054d8f1e9d55fe0c8b83677070ee3ebcfe54e Mon Sep 17 00:00:00 2001 From: Javier Smooth Date: Sat, 9 May 2015 12:30:26 -0700 Subject: [PATCH 03/10] params for live network --- src/cryptonote_config.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index c7002b0..95b9e48 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -30,7 +30,7 @@ #pragma once -#define HARDFORK_1_HEIGHT 1000 +#define HARDFORK_1_HEIGHT 5000000 #define HARDFORK_1_OLD_TARGET 1 #define HARDFORK_1_OLD_SPEED_FACTOR (20) #define HARDFORK_1_POW_SPEED_MULTIPLIER 2 @@ -88,8 +88,8 @@ #define CRYPTONOTE_MEMPOOL_TX_LIVETIME 86400 //seconds, one day #define CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME 604800 //seconds, one week -#define P2P_DEFAULT_PORT 31180 -#define RPC_DEFAULT_PORT 31181 +#define P2P_DEFAULT_PORT 11180 +#define RPC_DEFAULT_PORT 11181 #define COMMAND_RPC_GET_BLOCKS_FAST_MAX_COUNT 1000 #define P2P_LOCAL_WHITE_PEERLIST_LIMIT 1000 @@ -108,7 +108,7 @@ #define ALLOW_DEBUG_COMMANDS -#define CRYPTONOTE_NAME "aeone" +#define CRYPTONOTE_NAME "aeon" #define CRYPTONOTE_POOLDATA_FILENAME "poolstate.bin" #define CRYPTONOTE_BLOCKCHAINDATA_FILENAME "blockchain.bin" #define CRYPTONOTE_BLOCKCHAINDATA_TEMP_FILENAME "blockchain.bin.tmp" From b4e3cfa7711c316f109b2e7b65a7c57bd8b537b5 Mon Sep 17 00:00:00 2001 From: Javier Smooth Date: Sun, 10 May 2015 16:36:15 -0700 Subject: [PATCH 04/10] fix test case compile errors --- tests/core_tests/block_validation.cpp | 10 +++++----- tests/core_tests/chaingen.cpp | 10 +++++----- tests/core_tests/chaingen.h | 2 +- tests/unit_tests/block_reward.cpp | 16 +++++++++++----- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/tests/core_tests/block_validation.cpp b/tests/core_tests/block_validation.cpp index 7acd7f3..ccdc582 100644 --- a/tests/core_tests/block_validation.cpp +++ b/tests/core_tests/block_validation.cpp @@ -45,7 +45,7 @@ namespace for (size_t i = 0; i < new_block_count; ++i) { block blk_next; - difficulty_type diffic = next_difficulty(timestamps, cummulative_difficulties); + difficulty_type diffic = next_difficulty(timestamps, cummulative_difficulties, get_block_height(blk_prev)+1); if (!generator.construct_block_manually(blk_next, blk_prev, miner_account, test_generator::bf_timestamp | test_generator::bf_diffic, 0, 0, blk_prev.timestamp, crypto::hash(), diffic)) return false; @@ -175,9 +175,9 @@ bool gen_block_invalid_nonce::generate(std::vector& events) co return false; // Create invalid nonce - difficulty_type diffic = next_difficulty(timestamps, commulative_difficulties); - assert(1 < diffic); const block& blk_last = boost::get(events.back()); + difficulty_type diffic = next_difficulty(timestamps, commulative_difficulties, get_block_height(blk_last)+1); + assert(1 < diffic); uint64_t timestamp = blk_last.timestamp; block blk_3; do @@ -570,7 +570,7 @@ bool gen_block_invalid_binary_format::generate(std::vector& ev do { blk_last = boost::get(events.back()); - diffic = next_difficulty(timestamps, cummulative_difficulties); + diffic = next_difficulty(timestamps, cummulative_difficulties, get_block_height(blk_last)+1); if (!lift_up_difficulty(events, timestamps, cummulative_difficulties, generator, 1, blk_last, miner_account)) return false; std::cout << "Block #" << events.size() << ", difficulty: " << diffic << std::endl; @@ -585,7 +585,7 @@ bool gen_block_invalid_binary_format::generate(std::vector& ev std::vector tx_hashes; tx_hashes.push_back(get_transaction_hash(tx_0)); size_t txs_size = get_object_blobsize(tx_0); - diffic = next_difficulty(timestamps, cummulative_difficulties); + diffic = next_difficulty(timestamps, cummulative_difficulties, get_block_height(blk_last)+1); if (!generator.construct_block_manually(blk_test, blk_last, miner_account, test_generator::bf_diffic | test_generator::bf_timestamp | test_generator::bf_tx_hashes, 0, 0, blk_last.timestamp, crypto::hash(), diffic, transaction(), tx_hashes, txs_size)) diff --git a/tests/core_tests/chaingen.cpp b/tests/core_tests/chaingen.cpp index ad604d7..5db3d4e 100644 --- a/tests/core_tests/chaingen.cpp +++ b/tests/core_tests/chaingen.cpp @@ -94,11 +94,11 @@ uint64_t test_generator::get_already_generated_coins(const cryptonote::block& bl return get_already_generated_coins(blk_hash); } -void test_generator::add_block(const cryptonote::block& blk, size_t tsx_size, std::vector& block_sizes, uint64_t already_generated_coins) +void test_generator::add_block(const cryptonote::block& blk, size_t tsx_size, std::vector& block_sizes, uint64_t already_generated_coins, size_t height) { const size_t block_size = tsx_size + get_object_blobsize(blk.miner_tx); uint64_t block_reward; - get_block_reward(misc_utils::median(block_sizes), block_size, already_generated_coins, block_reward); + get_block_reward(misc_utils::median(block_sizes), block_size, already_generated_coins, block_reward, height); m_blocks_info[get_block_hash(blk)] = block_info(blk.prev_id, already_generated_coins + block_reward, block_size); } @@ -182,7 +182,7 @@ bool test_generator::construct_block(cryptonote::block& blk, uint64_t height, co while (!miner::find_nonce_for_given_block(blk, get_test_difficulty(), height)) blk.timestamp++; - add_block(blk, txs_size, block_sizes, already_generated_coins); + add_block(blk, txs_size, block_sizes, already_generated_coins,height); return true; } @@ -244,7 +244,7 @@ bool test_generator::construct_block_manually(block& blk, const block& prev_bloc difficulty_type a_diffic = actual_params & bf_diffic ? diffic : get_test_difficulty(); fill_nonce(blk, a_diffic, height); - add_block(blk, txs_sizes, block_sizes, already_generated_coins); + add_block(blk, txs_sizes, block_sizes, already_generated_coins, height); return true; } @@ -526,7 +526,7 @@ bool construct_miner_tx_manually(size_t height, uint64_t already_generated_coins // This will work, until size of constructed block is less then CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE uint64_t block_reward; - if (!get_block_reward(0, 0, already_generated_coins, block_reward)) + if (!get_block_reward(0, 0, already_generated_coins, block_reward, height)) { LOG_PRINT_L0("Block is too big"); return false; diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h index 1854262..795234b 100644 --- a/tests/core_tests/chaingen.h +++ b/tests/core_tests/chaingen.h @@ -228,7 +228,7 @@ public: uint64_t get_already_generated_coins(const crypto::hash& blk_id) const; uint64_t get_already_generated_coins(const cryptonote::block& blk) const; - void add_block(const cryptonote::block& blk, size_t tsx_size, std::vector& block_sizes, uint64_t already_generated_coins); + void add_block(const cryptonote::block& blk, size_t tsx_size, std::vector& block_sizes, uint64_t already_generated_coins, size_t height); bool construct_block(cryptonote::block& blk, uint64_t height, const crypto::hash& prev_id, const cryptonote::account_base& miner_acc, uint64_t timestamp, uint64_t already_generated_coins, std::vector& block_sizes, const std::list& tx_list); diff --git a/tests/unit_tests/block_reward.cpp b/tests/unit_tests/block_reward.cpp index 169d11a..4d1769e 100644 --- a/tests/unit_tests/block_reward.cpp +++ b/tests/unit_tests/block_reward.cpp @@ -46,8 +46,10 @@ namespace uint64_t m_block_reward; }; + // block 100k is below any hard fork, TODO add tests above hard forks + #define TEST_ALREADY_GENERATED_COINS(already_generated_coins, expected_reward) \ - m_block_not_too_big = get_block_reward(0, current_block_size, already_generated_coins, m_block_reward); \ + m_block_not_too_big = get_block_reward(0, current_block_size, already_generated_coins, m_block_reward, 100000); \ ASSERT_TRUE(m_block_not_too_big); \ ASSERT_EQ(m_block_reward, UINT64_C(expected_reward)); @@ -78,14 +80,16 @@ namespace protected: virtual void SetUp() { - m_block_not_too_big = get_block_reward(0, 0, already_generated_coins, m_standard_block_reward); + // block 100k is below any hard fork, TODO add tests above hard forks + m_block_not_too_big = get_block_reward(0, 0, already_generated_coins, m_standard_block_reward, 100000); ASSERT_TRUE(m_block_not_too_big); ASSERT_LT(CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE, m_standard_block_reward); } void do_test(size_t median_block_size, size_t current_block_size) { - m_block_not_too_big = get_block_reward(median_block_size, current_block_size, already_generated_coins, m_block_reward); + // block 100k is below any hard fork, TODO add tests above hard forks + m_block_not_too_big = get_block_reward(median_block_size, current_block_size, already_generated_coins, m_block_reward, 100000); } static const uint64_t already_generated_coins = 0; @@ -167,14 +171,16 @@ namespace m_last_block_sizes_median = 7 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE; - m_block_not_too_big = get_block_reward(epee::misc_utils::median(m_last_block_sizes), 0, already_generated_coins, m_standard_block_reward); + // block 100k is below any hard fork, TODO add tests above hard forks + m_block_not_too_big = get_block_reward(epee::misc_utils::median(m_last_block_sizes), 0, already_generated_coins, m_standard_block_reward,100000); ASSERT_TRUE(m_block_not_too_big); ASSERT_LT(CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE, m_standard_block_reward); } void do_test(size_t current_block_size) { - m_block_not_too_big = get_block_reward(epee::misc_utils::median(m_last_block_sizes), current_block_size, already_generated_coins, m_block_reward); + // block 100k is below any hard fork, TODO add tests above hard forks + m_block_not_too_big = get_block_reward(epee::misc_utils::median(m_last_block_sizes), current_block_size, already_generated_coins, m_block_reward, 100000); } static const uint64_t already_generated_coins = 0; From c59c9b39bad8a01650be171149f397fbae60d7f3 Mon Sep 17 00:00:00 2001 From: Javier Smooth Date: Mon, 11 May 2015 00:11:20 -0700 Subject: [PATCH 05/10] fix slow-hash (old) test --- tests/CMakeLists.txt | 2 +- tests/hash/{tests-slow.txt => tests-slow-2m.txt} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tests/hash/{tests-slow.txt => tests-slow-2m.txt} (100%) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 1d0c91d..841ffe3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -52,7 +52,7 @@ set_property(TARGET coretests crypto-tests functional_tests difficulty-tests gte add_test(coretests coretests --generate_and_play_test_data) add_test(crypto crypto-tests ${CMAKE_CURRENT_SOURCE_DIR}/crypto/tests.txt) add_test(difficulty difficulty-tests ${CMAKE_CURRENT_SOURCE_DIR}/difficulty/data.txt) -foreach(hash IN ITEMS fast slow tree extra-blake extra-groestl extra-jh extra-skein) +foreach(hash IN ITEMS fast slow-2m tree extra-blake extra-groestl extra-jh extra-skein) add_test(hash-${hash} hash-tests ${hash} ${CMAKE_CURRENT_SOURCE_DIR}/hash/tests-${hash}.txt) endforeach(hash) add_test(hash-target hash-target-tests) diff --git a/tests/hash/tests-slow.txt b/tests/hash/tests-slow-2m.txt similarity index 100% rename from tests/hash/tests-slow.txt rename to tests/hash/tests-slow-2m.txt From 082f523a13ec6e55a8f24563e773ca91b5101545 Mon Sep 17 00:00:00 2001 From: Javier Smooth Date: Mon, 11 May 2015 00:13:07 -0700 Subject: [PATCH 06/10] reenable checkpoints after testing --- src/cryptonote_core/checkpoints_create.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/cryptonote_core/checkpoints_create.h b/src/cryptonote_core/checkpoints_create.h index e6b5b1d..19ed135 100644 --- a/src/cryptonote_core/checkpoints_create.h +++ b/src/cryptonote_core/checkpoints_create.h @@ -38,7 +38,6 @@ namespace cryptonote { inline bool create_checkpoints(cryptonote::checkpoints& checkpoints) { -#if 0 ADD_CHECKPOINT(1, "1440a20f078bf3264822234b347f8382606577d73d4e9d3cb7296d73889bc421"); ADD_CHECKPOINT(100, "6dd13aaab16679f49ee6b2b75c7dc99b1fd09ab2282b18cb4b55b73110655742"); ADD_CHECKPOINT(1000, "bc6458452fd0575a314089bf302f6fd68ebaa2d689c42f3365293b96bbdf1f25"); @@ -46,7 +45,6 @@ namespace cryptonote { ADD_CHECKPOINT(15000, "15567af42afc1ed00538f53b5e3822d421e3ed6372ca79f4ea4e3e3bab709a87"); ADD_CHECKPOINT(175500, "3f7dd748b3b863b04654d87a387f2b65a365f467188971f3192eab2368e64a35"); -#endif return true; } } From da960131ed4dcc637e3c67bd556ceb861928232c Mon Sep 17 00:00:00 2001 From: Javier Smooth Date: Mon, 11 May 2015 03:21:53 -0700 Subject: [PATCH 07/10] update block target --- src/cryptonote_config.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 95b9e48..44bec52 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -31,7 +31,7 @@ #pragma once #define HARDFORK_1_HEIGHT 5000000 -#define HARDFORK_1_OLD_TARGET 1 +#define HARDFORK_1_OLD_TARGET 60 #define HARDFORK_1_OLD_SPEED_FACTOR (20) #define HARDFORK_1_POW_SPEED_MULTIPLIER 2 #define HARDFORK_1_DIFFADJ HARDFORK_1_POW_SPEED_MULTIPLIER @@ -67,7 +67,7 @@ #define ORPHANED_BLOCKS_MAX_COUNT 100 -#define DIFFICULTY_TARGET 4 // seconds +#define DIFFICULTY_TARGET 120 // seconds #define DIFFICULTY_WINDOW 720 // blocks #define DIFFICULTY_LAG 15 // !!! #define DIFFICULTY_CUT 60 // timestamps to cut after sorting From 4274ea7859d2eebf5e1194fb2f4c06af5970a184 Mon Sep 17 00:00:00 2001 From: Javier Smooth Date: Tue, 12 May 2015 01:35:33 -0700 Subject: [PATCH 08/10] 240 seconds for post-fork block time --- src/cryptonote_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 44bec52..72536d0 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -67,7 +67,7 @@ #define ORPHANED_BLOCKS_MAX_COUNT 100 -#define DIFFICULTY_TARGET 120 // seconds +#define DIFFICULTY_TARGET 240 // seconds #define DIFFICULTY_WINDOW 720 // blocks #define DIFFICULTY_LAG 15 // !!! #define DIFFICULTY_CUT 60 // timestamps to cut after sorting From a4ef992394613bebc2a57b96f9094af4194c3224 Mon Sep 17 00:00:00 2001 From: Javier Smooth Date: Tue, 12 May 2015 01:43:16 -0700 Subject: [PATCH 09/10] verify checkpoints upon loading saved blockchain (from Monero); add recent checkpoint --- src/cryptonote_core/blockchain_storage.cpp | 13 ++++++++++++- src/cryptonote_core/checkpoints_create.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/cryptonote_core/blockchain_storage.cpp b/src/cryptonote_core/blockchain_storage.cpp index a5d7eaa..61903c2 100644 --- a/src/cryptonote_core/blockchain_storage.cpp +++ b/src/cryptonote_core/blockchain_storage.cpp @@ -89,7 +89,17 @@ bool blockchain_storage::init(const std::string& config_folder) m_config_folder = config_folder; LOG_PRINT_L0("Loading blockchain..."); const std::string filename = m_config_folder + "/" CRYPTONOTE_BLOCKCHAINDATA_FILENAME; - if(!tools::unserialize_obj_from_file(*this, filename)) + if(tools::unserialize_obj_from_file(*this, filename)) + { + // checkpoints + + // mainchain + for (size_t height=0; height < m_blocks.size(); ++height) + { + CHECK_AND_ASSERT_MES((!m_checkpoints.is_in_checkpoint_zone(height)) || m_checkpoints.check_block(height,get_block_hash(m_blocks[height].bl)),false,"checkpoint fail, blockchain.bin invalid"); + } + } + else { LOG_PRINT_L0("Can't load blockchain storage from file, generating genesis block."); block bl = boost::value_initialized(); @@ -98,6 +108,7 @@ bool blockchain_storage::init(const std::string& config_folder) add_new_block(bl, bvc); CHECK_AND_ASSERT_MES(!bvc.m_verifivation_failed && bvc.m_added_to_main_chain, false, "Failed to add genesis block to blockchain"); } + if(!m_blocks.size()) { LOG_PRINT_L0("Blockchain not loaded, generating genesis block."); diff --git a/src/cryptonote_core/checkpoints_create.h b/src/cryptonote_core/checkpoints_create.h index 19ed135..fb604db 100644 --- a/src/cryptonote_core/checkpoints_create.h +++ b/src/cryptonote_core/checkpoints_create.h @@ -44,6 +44,7 @@ namespace cryptonote { ADD_CHECKPOINT(10000, "1ac1ebd25baf0d6ec593daa3389f1aa7e860ff2cc29f3cf1be586d245b379da4"); ADD_CHECKPOINT(15000, "15567af42afc1ed00538f53b5e3822d421e3ed6372ca79f4ea4e3e3bab709a87"); ADD_CHECKPOINT(175500, "3f7dd748b3b863b04654d87a387f2b65a365f467188971f3192eab2368e64a35"); + ADD_CHECKPOINT(450000, "f69a6e57c4dd5df2f492c9d31c50f11aad2c25a64d540ce5f5d11b572aec8ab7"); return true; } From f230abbe72c3233705a334f45ec324adcfb0a12b Mon Sep 17 00:00:00 2001 From: Javier Smooth Date: Tue, 21 Jul 2015 10:20:34 -0700 Subject: [PATCH 10/10] assign height for hard fork 1, bump version to 0.9.0.0 --- src/cryptonote_config.h | 4 ++-- src/version.h.in | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cryptonote_config.h b/src/cryptonote_config.h index 72536d0..ec176ef 100644 --- a/src/cryptonote_config.h +++ b/src/cryptonote_config.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014, AEON, The Monero Project +// Copyright (c) 2014, 2015 AEON, The Monero Project // // All rights reserved. // @@ -30,7 +30,7 @@ #pragma once -#define HARDFORK_1_HEIGHT 5000000 +#define HARDFORK_1_HEIGHT 592000 #define HARDFORK_1_OLD_TARGET 60 #define HARDFORK_1_OLD_SPEED_FACTOR (20) #define HARDFORK_1_POW_SPEED_MULTIPLIER 2 diff --git a/src/version.h.in b/src/version.h.in index 373068e..e1e5de8 100644 --- a/src/version.h.in +++ b/src/version.h.in @@ -1,4 +1,4 @@ #define BUILD_COMMIT_ID "@VERSION@" -#define PROJECT_VERSION "0.8.8" -#define PROJECT_VERSION_BUILD_NO "2" +#define PROJECT_VERSION "0.9.0" +#define PROJECT_VERSION_BUILD_NO "0" #define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO "(" BUILD_COMMIT_ID ")"