diff options
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 13 | ||||
-rw-r--r-- | src/cryptonote_core/blockchain.h | 10 | ||||
-rw-r--r-- | src/cryptonote_core/blockchain_storage_boost_serialization.h | 2 | ||||
-rw-r--r-- | src/cryptonote_core/cryptonote_core.cpp | 8 | ||||
-rw-r--r-- | src/cryptonote_core/cryptonote_core.h | 2 | ||||
-rw-r--r-- | src/cryptonote_core/cryptonote_tx_utils.cpp | 2 | ||||
-rw-r--r-- | src/cryptonote_core/cryptonote_tx_utils.h | 2 | ||||
-rw-r--r-- | src/cryptonote_core/tx_pool.cpp | 2 | ||||
-rw-r--r-- | src/cryptonote_core/tx_pool.h | 2 |
10 files changed, 33 insertions, 12 deletions
diff --git a/src/cryptonote_core/CMakeLists.txt b/src/cryptonote_core/CMakeLists.txt index eeed881da..d8a21ae31 100644 --- a/src/cryptonote_core/CMakeLists.txt +++ b/src/cryptonote_core/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2014-2017, The Monero Project +# Copyright (c) 2014-2018, The Monero Project # # All rights reserved. # diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 4af987c3b..178479f3c 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2017, The Monero Project +// Copyright (c) 2014-2018, The Monero Project // // All rights reserved. // @@ -133,7 +133,7 @@ static const uint64_t testnet_hard_fork_version_1_till = 624633; //------------------------------------------------------------------ Blockchain::Blockchain(tx_memory_pool& tx_pool) : - m_db(), m_tx_pool(tx_pool), m_hardfork(NULL), m_timestamps_and_difficulties_height(0), m_current_block_cumul_sz_limit(0), + m_db(), m_tx_pool(tx_pool), m_hardfork(NULL), m_timestamps_and_difficulties_height(0), m_current_block_cumul_sz_limit(0), m_current_block_cumul_sz_median(0), m_enforce_dns_checkpoints(false), m_max_prepare_blocks_threads(4), m_db_blocks_per_sync(1), m_db_sync_mode(db_async), m_db_default_sync(false), m_fast_sync(true), m_show_time_stats(false), m_sync_counter(0), m_cancel(false) { LOG_PRINT_L3("Blockchain::" << __func__); @@ -1101,6 +1101,12 @@ uint64_t Blockchain::get_current_cumulative_blocksize_limit() const return m_current_block_cumul_sz_limit; } //------------------------------------------------------------------ +uint64_t Blockchain::get_current_cumulative_blocksize_median() const +{ + LOG_PRINT_L3("Blockchain::" << __func__); + return m_current_block_cumul_sz_median; +} +//------------------------------------------------------------------ //TODO: This function only needed minor modification to work with BlockchainDB, // and *works*. As such, to reduce the number of things that might break // in moving to BlockchainDB, this function will remain otherwise @@ -2933,7 +2939,7 @@ bool Blockchain::check_fee(size_t blob_size, uint64_t fee) const needed_fee += (blob_size % 1024) ? 1 : 0; needed_fee *= fee_per_kb; - if (fee < needed_fee * 0.98) // keep a little buffer on acceptance + if (fee < needed_fee - needed_fee / 50) // keep a little 2% buffer on acceptance - no integer overflow { MERROR_VER("transaction fee is not enough: " << print_money(fee) << ", minimum fee: " << print_money(needed_fee)); return false; @@ -3518,6 +3524,7 @@ bool Blockchain::update_next_cumulative_size_limit() get_last_n_blocks_sizes(sz, CRYPTONOTE_REWARD_BLOCKS_WINDOW); uint64_t median = epee::misc_utils::median(sz); + m_current_block_cumul_sz_median = median; if(median <= full_reward_zone) median = full_reward_zone; diff --git a/src/cryptonote_core/blockchain.h b/src/cryptonote_core/blockchain.h index 25e573a2c..b2bbff488 100644 --- a/src/cryptonote_core/blockchain.h +++ b/src/cryptonote_core/blockchain.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2017, The Monero Project +// Copyright (c) 2014-2018, The Monero Project // // All rights reserved. // @@ -637,6 +637,13 @@ namespace cryptonote uint64_t get_current_cumulative_blocksize_limit() const; /** + * @brief gets the blocksize median based on recent blocks (same window as for the limit) + * + * @return the median + */ + uint64_t get_current_cumulative_blocksize_median() const; + + /** * @brief gets the difficulty of the block with a given height * * @param i the height @@ -962,6 +969,7 @@ namespace cryptonote // main chain transactions_container m_transactions; size_t m_current_block_cumul_sz_limit; + size_t m_current_block_cumul_sz_median; // metadata containers std::unordered_map<crypto::hash, std::unordered_map<crypto::key_image, std::vector<output_data_t>>> m_scan_table; diff --git a/src/cryptonote_core/blockchain_storage_boost_serialization.h b/src/cryptonote_core/blockchain_storage_boost_serialization.h index e87a51f10..f4f9f20ca 100644 --- a/src/cryptonote_core/blockchain_storage_boost_serialization.h +++ b/src/cryptonote_core/blockchain_storage_boost_serialization.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2017, The Monero Project +// Copyright (c) 2014-2018, The Monero Project // // All rights reserved. // diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index adbc727b0..81a7b4724 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2017, The Monero Project +// Copyright (c) 2014-2018, The Monero Project // // All rights reserved. // @@ -83,6 +83,10 @@ namespace cryptonote "offline" , "Do not listen for peers, nor connect to any" }; + const command_line::arg_descriptor<bool> arg_disable_dns_checkpoints = { + "disable-dns-checkpoints" + , "Do not retrieve checkpoints from DNS" + }; static const command_line::arg_descriptor<bool> arg_test_drop_download = { "test-drop-download" @@ -236,6 +240,7 @@ namespace cryptonote command_line::add_arg(desc, arg_fluffy_blocks); command_line::add_arg(desc, arg_test_dbg_lock_sleep); command_line::add_arg(desc, arg_offline); + command_line::add_arg(desc, arg_disable_dns_checkpoints); miner::init_options(desc); BlockchainDB::init_options(desc); @@ -270,6 +275,7 @@ namespace cryptonote test_drop_download_height(command_line::get_arg(vm, arg_test_drop_download_height)); m_fluffy_blocks_enabled = m_testnet || get_arg(vm, arg_fluffy_blocks); m_offline = get_arg(vm, arg_offline); + m_disable_dns_checkpoints = get_arg(vm, arg_disable_dns_checkpoints); if (command_line::get_arg(vm, arg_test_drop_download) == true) test_drop_download(); diff --git a/src/cryptonote_core/cryptonote_core.h b/src/cryptonote_core/cryptonote_core.h index adc201fb5..429f6b820 100644 --- a/src/cryptonote_core/cryptonote_core.h +++ b/src/cryptonote_core/cryptonote_core.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2017, The Monero Project +// Copyright (c) 2014-2018, The Monero Project // // All rights reserved. // diff --git a/src/cryptonote_core/cryptonote_tx_utils.cpp b/src/cryptonote_core/cryptonote_tx_utils.cpp index 916b1e05a..431d71556 100644 --- a/src/cryptonote_core/cryptonote_tx_utils.cpp +++ b/src/cryptonote_core/cryptonote_tx_utils.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2017, The Monero Project +// Copyright (c) 2014-2018, The Monero Project // // All rights reserved. // diff --git a/src/cryptonote_core/cryptonote_tx_utils.h b/src/cryptonote_core/cryptonote_tx_utils.h index 5947522e2..e3b7a4f8c 100644 --- a/src/cryptonote_core/cryptonote_tx_utils.h +++ b/src/cryptonote_core/cryptonote_tx_utils.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2017, The Monero Project +// Copyright (c) 2014-2018, The Monero Project // // All rights reserved. // diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index 8773c1f74..e75584bce 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2017, The Monero Project +// Copyright (c) 2014-2018, The Monero Project // // All rights reserved. // diff --git a/src/cryptonote_core/tx_pool.h b/src/cryptonote_core/tx_pool.h index d657c6554..b4ea5a8f4 100644 --- a/src/cryptonote_core/tx_pool.h +++ b/src/cryptonote_core/tx_pool.h @@ -1,4 +1,4 @@ -// Copyright (c) 2014-2017, The Monero Project +// Copyright (c) 2014-2018, The Monero Project // // All rights reserved. // |