diff --git a/src/blockchain_db/berkeleydb/db_bdb.cpp b/src/blockchain_db/berkeleydb/db_bdb.cpp index ce355ccd..07cb622a 100644 --- a/src/blockchain_db/berkeleydb/db_bdb.cpp +++ b/src/blockchain_db/berkeleydb/db_bdb.cpp @@ -759,7 +759,7 @@ void BlockchainBDB::open(const std::string& filename, const int db_flags) } else { - if (!boost::filesystem::create_directory(direc)) + if (!boost::filesystem::create_directories(direc)) throw0(DB_OPEN_FAILURE(std::string("Failed to create directory ").append(filename).c_str())); } @@ -1042,7 +1042,46 @@ void BlockchainBDB::sync() void BlockchainBDB::reset() { LOG_PRINT_L3("BlockchainBDB::" << __func__); - // TODO: this + check_open(); + + bdb_txn_safe txn; + if (m_env->txn_begin(NULL, txn, 0)) + throw0(DB_ERROR("Failed to create a transaction for the db")); + m_write_txn = &txn; + try + { + uint32_t count; + + m_blocks->truncate(*m_write_txn, &count, 0); + m_block_heights->truncate(*m_write_txn, &count, 0); + m_block_hashes->truncate(*m_write_txn, &count, 0); + m_block_timestamps->truncate(*m_write_txn, &count, 0); + m_block_sizes->truncate(*m_write_txn, &count, 0); + m_block_diffs->truncate(*m_write_txn, &count, 0); + m_block_coins->truncate(*m_write_txn, &count, 0); + + m_txs->truncate(*m_write_txn, &count, 0); + m_tx_unlocks->truncate(*m_write_txn, &count, 0); + m_tx_heights->truncate(*m_write_txn, &count, 0); + m_tx_outputs->truncate(*m_write_txn, &count, 0); + + m_output_txs->truncate(*m_write_txn, &count, 0); + m_output_indices->truncate(*m_write_txn, &count, 0); + m_output_amounts->truncate(*m_write_txn, &count, 0); + m_output_keys->truncate(*m_write_txn, &count, 0); + + m_spent_keys->truncate(*m_write_txn, &count, 0); + + m_hf_starting_heights->truncate(*m_write_txn, &count, 0); + m_hf_versions->truncate(*m_write_txn, &count, 0); + + m_properties->truncate(*m_write_txn, &count, 0); + } + catch (const std::exception& e) + { + throw0(DB_ERROR(std::string("Failed to reset database: ").append(e.what()).c_str())); + } + m_write_txn = NULL; } std::vector BlockchainBDB::get_filenames() const diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index fabe01d7..9be21b03 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -943,7 +943,7 @@ void BlockchainLMDB::open(const std::string& filename, const int mdb_flags) } else { - if (!boost::filesystem::create_directory(direc)) + if (!boost::filesystem::create_directories(direc)) throw0(DB_OPEN_FAILURE(std::string("Failed to create directory ").append(filename).c_str())); } @@ -1159,7 +1159,33 @@ void BlockchainLMDB::sync() void BlockchainLMDB::reset() { LOG_PRINT_L3("BlockchainLMDB::" << __func__); - // TODO: this + check_open(); + + mdb_txn_safe txn; + if (mdb_txn_begin(m_env, NULL, 0, txn)) + throw0(DB_ERROR("Failed to create a transaction for the db")); + mdb_drop(txn, m_blocks, 0); + mdb_drop(txn, m_block_timestamps, 0); + mdb_drop(txn, m_block_heights, 0); + mdb_drop(txn, m_block_hashes, 0); + mdb_drop(txn, m_block_sizes, 0); + mdb_drop(txn, m_block_diffs, 0); + mdb_drop(txn, m_block_coins, 0); + mdb_drop(txn, m_txs, 0); + mdb_drop(txn, m_tx_unlocks, 0); + mdb_drop(txn, m_tx_heights, 0); + mdb_drop(txn, m_tx_outputs, 0); + mdb_drop(txn, m_output_txs, 0); + mdb_drop(txn, m_output_indices, 0); + mdb_drop(txn, m_output_amounts, 0); + mdb_drop(txn, m_output_keys, 0); + mdb_drop(txn, m_spent_keys, 0); + mdb_drop(txn, m_hf_starting_heights, 0); + mdb_drop(txn, m_hf_versions, 0); + mdb_drop(txn, m_properties, 0); + txn.commit(); + m_height = 0; + m_num_outputs = 0; } std::vector BlockchainLMDB::get_filenames() const diff --git a/src/common/command_line.cpp b/src/common/command_line.cpp index 925b62a5..5e5a9ff4 100644 --- a/src/common/command_line.cpp +++ b/src/common/command_line.cpp @@ -91,4 +91,9 @@ namespace command_line , "Show time-stats when processing blocks/txs and disk synchronization." , 0 }; + const command_line::arg_descriptor arg_fakechain = { + "fakechain" + , "Use a fake chain for testing purposes." + , false + }; } diff --git a/src/common/command_line.h b/src/common/command_line.h index ffac7170..8955b826 100644 --- a/src/common/command_line.h +++ b/src/common/command_line.h @@ -215,4 +215,5 @@ namespace command_line extern const arg_descriptor arg_prep_blocks_threads; extern const arg_descriptor arg_db_auto_remove_logs; extern const arg_descriptor arg_show_time_stats; + extern const arg_descriptor arg_fakechain; } diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 2d71b61a..5823c86f 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -236,7 +236,7 @@ uint64_t Blockchain::get_current_blockchain_height() const //------------------------------------------------------------------ //FIXME: possibly move this into the constructor, to avoid accidentally // dereferencing a null BlockchainDB pointer -bool Blockchain::init(BlockchainDB* db, const bool testnet) +bool Blockchain::init(BlockchainDB* db, const bool testnet, const bool fakechain) { LOG_PRINT_L3("Blockchain::" << __func__); CRITICAL_REGION_LOCAL(m_blockchain_lock); @@ -293,8 +293,11 @@ bool Blockchain::init(BlockchainDB* db, const bool testnet) { } - // ensure we fixup anything we found and fix in the future - m_db->fixup(); + if (!fakechain) + { + // ensure we fixup anything we found and fix in the future + m_db->fixup(); + } // check how far behind we are uint64_t top_block_timestamp = m_db->get_top_block_timestamp(); @@ -311,7 +314,7 @@ bool Blockchain::init(BlockchainDB* db, const bool testnet) m_async_pool.create_thread(boost::bind(&boost::asio::io_service::run, &m_async_service)); #if defined(PER_BLOCK_CHECKPOINT) - if (m_fast_sync && get_blocks_dat_start(testnet) != nullptr) + if (!fakechain && m_fast_sync && get_blocks_dat_start(testnet) != nullptr) { if (get_blocks_dat_size(testnet) > 4) { @@ -1361,7 +1364,7 @@ bool Blockchain::get_blocks(uint64_t start_offset, size_t count, std::list m_db->height()) return false; - for(size_t i = start_offset; i < start_offset + count && i <= m_db->height();i++) + for(size_t i = start_offset; i < start_offset + count && i < m_db->height();i++) { blocks.push_back(m_db->get_block_from_height(i)); } @@ -2631,7 +2634,7 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash& // do this after updating the hard fork state since the size limit may change due to fork update_next_cumulative_size_limit(); - LOG_PRINT_L1("+++++ BLOCK SUCCESSFULLY ADDED" << std::endl << "id:\t" << id << std::endl << "PoW:\t" << proof_of_work << std::endl << "HEIGHT " << new_height << ", difficulty:\t" << current_diffic << std::endl << "block reward: " << print_money(fee_summary + base_reward) << "(" << print_money(base_reward) << " + " << print_money(fee_summary) << "), coinbase_blob_size: " << coinbase_blob_size << ", cumulative size: " << cumulative_block_size << ", " << block_processing_time << "(" << target_calculating_time << "/" << longhash_calculating_time << ")ms"); + LOG_PRINT_L1("+++++ BLOCK SUCCESSFULLY ADDED" << std::endl << "id:\t" << id << std::endl << "PoW:\t" << proof_of_work << std::endl << "HEIGHT " << new_height-1 << ", difficulty:\t" << current_diffic << std::endl << "block reward: " << print_money(fee_summary + base_reward) << "(" << print_money(base_reward) << " + " << print_money(fee_summary) << "), coinbase_blob_size: " << coinbase_blob_size << ", cumulative size: " << cumulative_block_size << ", " << block_processing_time << "(" << target_calculating_time << "/" << longhash_calculating_time << ")ms"); if(m_show_time_stats) { LOG_PRINT_L0("Height: " << new_height << " blob: " << coinbase_blob_size << " cumm: " diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h index c8331463..f0b03ab0 100644 --- a/src/cryptonote_core/blockchain.h +++ b/src/cryptonote_core/blockchain.h @@ -91,7 +91,7 @@ namespace cryptonote Blockchain(tx_memory_pool& tx_pool); - bool init(BlockchainDB* db, const bool testnet = false); + bool init(BlockchainDB* db, const bool testnet = false, const bool fakechain = false); bool deinit(); void set_checkpoints(checkpoints&& chk_pts) { m_checkpoints = chk_pts; } diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 2f21bd4f..960c8eff 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -97,7 +97,7 @@ namespace cryptonote //----------------------------------------------------------------------------------------------- bool core::update_checkpoints() { - if (m_testnet) return true; + if (m_testnet || m_fakechain) return true; if (m_checkpoints_updating.test_and_set()) return true; @@ -145,18 +145,20 @@ namespace cryptonote command_line::add_arg(desc, command_line::arg_db_sync_mode); command_line::add_arg(desc, command_line::arg_show_time_stats); command_line::add_arg(desc, command_line::arg_db_auto_remove_logs); + command_line::add_arg(desc, command_line::arg_fakechain); } //----------------------------------------------------------------------------------------------- bool core::handle_command_line(const boost::program_options::variables_map& vm) { m_testnet = command_line::get_arg(vm, command_line::arg_testnet_on); + m_fakechain = command_line::get_arg(vm, command_line::arg_fakechain); auto data_dir_arg = m_testnet ? command_line::arg_testnet_data_dir : command_line::arg_data_dir; m_config_folder = command_line::get_arg(vm, data_dir_arg); auto data_dir = boost::filesystem::path(m_config_folder); - if (!m_testnet) + if (!m_testnet && !m_fakechain) { cryptonote::checkpoints checkpoints; if (!cryptonote::create_checkpoints(checkpoints)) @@ -257,6 +259,9 @@ namespace cryptonote boost::filesystem::path folder(m_config_folder); + if (m_fakechain) + folder /= "fake"; + folder /= db->get_db_name(); LOG_PRINT_L0("Loading blockchain from folder " << folder.string() << " ..."); @@ -337,7 +342,7 @@ namespace cryptonote m_blockchain_storage.set_user_options(blocks_threads, blocks_per_sync, sync_mode, fast_sync); - r = m_blockchain_storage.init(db, m_testnet); + r = m_blockchain_storage.init(db, m_testnet, m_fakechain); bool show_time_stats = command_line::get_arg(vm, command_line::arg_show_time_stats) != 0; m_blockchain_storage.set_show_time_stats(show_time_stats); diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h index e7a6c415..5d665cb9 100644 --- a/src/cryptonote_core/cryptonote_core.h +++ b/src/cryptonote_core/cryptonote_core.h @@ -199,6 +199,7 @@ namespace cryptonote uint64_t m_target_blockchain_height; bool m_testnet; + bool m_fakechain; std::string m_checkpoints_path; time_t m_last_dns_checkpoints_update; time_t m_last_json_checkpoints_update; diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index defbeb3b..e2dcd35f 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -113,7 +113,7 @@ namespace cryptonote needed_fee *= FEE_PER_KB; if (!kept_by_block && fee < needed_fee /*&& fee < MINING_ALLOWED_LEGACY_FEE*/) { - LOG_PRINT_L1("transaction fee is not enough: " << print_money(fee) << ", minumim fee: " << print_money(needed_fee)); + LOG_PRINT_L1("transaction fee is not enough: " << print_money(fee) << ", minimum fee: " << print_money(needed_fee)); tvc.m_verifivation_failed = true; return false; } diff --git a/tests/core_tests/chaingen.h b/tests/core_tests/chaingen.h index 0c33b942..822ccfb1 100644 --- a/tests/core_tests/chaingen.h +++ b/tests/core_tests/chaingen.h @@ -474,7 +474,6 @@ inline bool do_replay_events(std::vector& events) { boost::program_options::options_description desc("Allowed options"); cryptonote::core::init_options(desc); - command_line::add_arg(desc, command_line::arg_data_dir); boost::program_options::variables_map vm; bool r = command_line::handle_error_helper(desc, [&]() { @@ -485,6 +484,10 @@ inline bool do_replay_events(std::vector& events) if (!r) return false; + // hardcode a --fakechain option for tests + static const char * const fakechain[] = {"", "--fakechain"}; + boost::program_options::store(boost::program_options::parse_command_line(2, fakechain, desc), vm); + cryptonote::cryptonote_protocol_stub pr; //TODO: stub only for this kind of test, make real validation of relayed objects cryptonote::core c(&pr); // FIXME: make sure that vm has arg_testnet_on set to true or false if @@ -671,4 +674,4 @@ inline bool do_replay_file(const std::string& filename) #define CHECK_EQ(v1, v2) CHECK_AND_ASSERT_MES(v1 == v2, false, "[" << perr_context << "] failed: \"" << QUOTEME(v1) << " == " << QUOTEME(v2) << "\", " << v1 << " != " << v2) #define CHECK_NOT_EQ(v1, v2) CHECK_AND_ASSERT_MES(!(v1 == v2), false, "[" << perr_context << "] failed: \"" << QUOTEME(v1) << " != " << QUOTEME(v2) << "\", " << v1 << " == " << v2) #define MK_COINS(amount) (UINT64_C(amount) * COIN) -#define TESTS_DEFAULT_FEE ((uint64_t)1000000) // pow(10, 6) +#define TESTS_DEFAULT_FEE ((uint64_t)20000000000) // 2 * pow(10, 10) diff --git a/tests/core_tests/ring_signature_1.cpp b/tests/core_tests/ring_signature_1.cpp index 15b6531c..b37b55cc 100644 --- a/tests/core_tests/ring_signature_1.cpp +++ b/tests/core_tests/ring_signature_1.cpp @@ -144,7 +144,7 @@ gen_ring_signature_2::gen_ring_signature_2() } /** - * Bob has 4 inputs by 61 coins. He sends 4 * 61 coins to Alice, using ring signature with nmix = 3. Each Bob's input + * Bob has 4 inputs by 13 coins. He sends 4 * 13 coins to Alice, using ring signature with nmix = 3. Each Bob's input * is used as mix for 3 others. */ bool gen_ring_signature_2::generate(std::vector& events) const @@ -161,14 +161,14 @@ bool gen_ring_signature_2::generate(std::vector& events) const MAKE_NEXT_BLOCK(events, blk_2, blk_1, miner_account); // 4 MAKE_NEXT_BLOCK(events, blk_3, blk_2, miner_account); // 5 REWIND_BLOCKS(events, blk_3r, blk_3, miner_account); // - MAKE_TX_LIST_START(events, txs_blk_4, miner_account, bob_account, MK_COINS(61), blk_3); // 6 + N - MAKE_TX_LIST(events, txs_blk_4, miner_account, bob_account, MK_COINS(61), blk_3); // 7 + N - MAKE_TX_LIST(events, txs_blk_4, miner_account, bob_account, MK_COINS(61), blk_3); // 8 + N - MAKE_TX_LIST(events, txs_blk_4, miner_account, bob_account, MK_COINS(61), blk_3); // 9 + N + MAKE_TX_LIST_START(events, txs_blk_4, miner_account, bob_account, MK_COINS(13), blk_3); // 6 + N + MAKE_TX_LIST(events, txs_blk_4, miner_account, bob_account, MK_COINS(13), blk_3); // 7 + N + MAKE_TX_LIST(events, txs_blk_4, miner_account, bob_account, MK_COINS(13), blk_3); // 8 + N + MAKE_TX_LIST(events, txs_blk_4, miner_account, bob_account, MK_COINS(13), blk_3); // 9 + N MAKE_NEXT_BLOCK_TX_LIST(events, blk_4, blk_3r, miner_account, txs_blk_4); // 10 + N DO_CALLBACK(events, "check_balances_1"); // 11 + N REWIND_BLOCKS(events, blk_4r, blk_4, miner_account); // - MAKE_TX_MIX(events, tx_0, bob_account, alice_account, MK_COINS(244) - TESTS_DEFAULT_FEE, 3, blk_4); // 12 + 2N + MAKE_TX_MIX(events, tx_0, bob_account, alice_account, MK_COINS(52) - TESTS_DEFAULT_FEE, 3, blk_4); // 12 + 2N MAKE_NEXT_BLOCK_TX1(events, blk_5, blk_4r, miner_account, tx_0); // 13 + 2N DO_CALLBACK(events, "check_balances_2"); // 14 + 2N @@ -190,7 +190,7 @@ bool gen_ring_signature_2::check_balances_1(cryptonote::core& c, size_t ev_index map_hash2tx_t mtx; r = find_block_chain(events, chain, mtx, get_block_hash(blocks.back())); CHECK_TEST_CONDITION(r); - CHECK_EQ(MK_COINS(244), get_balance(m_bob_account, chain, mtx)); + CHECK_EQ(MK_COINS(52), get_balance(m_bob_account, chain, mtx)); CHECK_EQ(0, get_balance(m_alice_account, chain, mtx)); return true; @@ -209,7 +209,7 @@ bool gen_ring_signature_2::check_balances_2(cryptonote::core& c, size_t ev_index r = find_block_chain(events, chain, mtx, get_block_hash(blocks.back())); CHECK_TEST_CONDITION(r); CHECK_EQ(0, get_balance(m_bob_account, chain, mtx)); - CHECK_EQ(MK_COINS(244) - TESTS_DEFAULT_FEE, get_balance(m_alice_account, chain, mtx)); + CHECK_EQ(MK_COINS(52) - TESTS_DEFAULT_FEE, get_balance(m_alice_account, chain, mtx)); return true; } diff --git a/tests/unit_tests/block_reward.cpp b/tests/unit_tests/block_reward.cpp index 308ef299..125cad82 100644 --- a/tests/unit_tests/block_reward.cpp +++ b/tests/unit_tests/block_reward.cpp @@ -40,7 +40,7 @@ namespace class block_reward_and_already_generated_coins : public ::testing::Test { protected: - static const size_t current_block_size = CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE / 2; + static const size_t current_block_size = CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 / 2; bool m_block_not_too_big; uint64_t m_block_reward; @@ -81,7 +81,7 @@ namespace { m_block_not_too_big = get_block_reward(0, 0, already_generated_coins, m_standard_block_reward, 1); ASSERT_TRUE(m_block_not_too_big); - ASSERT_LT(CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE, m_standard_block_reward); + ASSERT_LT(CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1, m_standard_block_reward); } void do_test(size_t median_block_size, size_t current_block_size) @@ -98,28 +98,28 @@ namespace TEST_F(block_reward_and_current_block_size, handles_block_size_less_relevance_level) { - do_test(0, CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE - 1); + do_test(0, CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 - 1); ASSERT_TRUE(m_block_not_too_big); ASSERT_EQ(m_block_reward, m_standard_block_reward); } TEST_F(block_reward_and_current_block_size, handles_block_size_eq_relevance_level) { - do_test(0, CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE); + do_test(0, CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1); ASSERT_TRUE(m_block_not_too_big); ASSERT_EQ(m_block_reward, m_standard_block_reward); } TEST_F(block_reward_and_current_block_size, handles_block_size_gt_relevance_level) { - do_test(0, CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE + 1); + do_test(0, CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 + 1); ASSERT_TRUE(m_block_not_too_big); ASSERT_LT(m_block_reward, m_standard_block_reward); } TEST_F(block_reward_and_current_block_size, handles_block_size_less_2_relevance_level) { - do_test(0, 2 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE - 1); + do_test(0, 2 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 - 1); ASSERT_TRUE(m_block_not_too_big); ASSERT_LT(m_block_reward, m_standard_block_reward); ASSERT_LT(0, m_block_reward); @@ -127,14 +127,14 @@ namespace TEST_F(block_reward_and_current_block_size, handles_block_size_eq_2_relevance_level) { - do_test(0, 2 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE); + do_test(0, 2 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1); ASSERT_TRUE(m_block_not_too_big); ASSERT_EQ(0, m_block_reward); } TEST_F(block_reward_and_current_block_size, handles_block_size_gt_2_relevance_level) { - do_test(0, 2 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE + 1); + do_test(0, 2 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 + 1); ASSERT_FALSE(m_block_not_too_big); } @@ -160,17 +160,17 @@ namespace protected: virtual void SetUp() { - m_last_block_sizes.push_back(3 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE); - m_last_block_sizes.push_back(5 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE); - m_last_block_sizes.push_back(7 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE); - m_last_block_sizes.push_back(11 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE); - m_last_block_sizes.push_back(13 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE); + m_last_block_sizes.push_back(3 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1); + m_last_block_sizes.push_back(5 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1); + m_last_block_sizes.push_back(7 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1); + m_last_block_sizes.push_back(11 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1); + m_last_block_sizes.push_back(13 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1); - m_last_block_sizes_median = 7 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE; + m_last_block_sizes_median = 7 * CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1; m_block_not_too_big = get_block_reward(epee::misc_utils::median(m_last_block_sizes), 0, already_generated_coins, m_standard_block_reward, 1); ASSERT_TRUE(m_block_not_too_big); - ASSERT_LT(CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE, m_standard_block_reward); + ASSERT_LT(CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1, m_standard_block_reward); } void do_test(size_t current_block_size) diff --git a/tests/unit_tests/checkpoints.cpp b/tests/unit_tests/checkpoints.cpp index 2f70791c..85a8c9a9 100644 --- a/tests/unit_tests/checkpoints.cpp +++ b/tests/unit_tests/checkpoints.cpp @@ -35,7 +35,7 @@ using namespace cryptonote; -TEST(checkpoints_is_alternative_block_allowed, handles_empty_checkpoins) +TEST(checkpoints_is_alternative_block_allowed, handles_empty_checkpoints) { checkpoints cp;