diff options
author | luigi1111 <luigi1111w@gmail.com> | 2019-10-22 10:09:56 -0500 |
---|---|---|
committer | luigi1111 <luigi1111w@gmail.com> | 2019-10-22 10:09:56 -0500 |
commit | 8bb3c6a8e6861925e59240acb311811f0792f3eb (patch) | |
tree | b038b7d6e6f04a4227ed837e892b56bbdaff6fb8 /src/cryptonote_core | |
parent | Merge pull request #5966 (diff) | |
parent | blockchain: use effective median block weight for penalty from v12 (diff) | |
download | monero-8bb3c6a8e6861925e59240acb311811f0792f3eb.tar.xz |
Merge pull request #5970
ab96181 blockchain: use effective median block weight for penalty from v12 (moneromooo-monero)
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 2f3dda09c..9f4e91532 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -1176,9 +1176,18 @@ bool Blockchain::validate_miner_transaction(const block& b, size_t cumulative_bl } } - std::vector<uint64_t> last_blocks_weights; - get_last_n_blocks_weights(last_blocks_weights, CRYPTONOTE_REWARD_BLOCKS_WINDOW); - if (!get_block_reward(epee::misc_utils::median(last_blocks_weights), cumulative_block_weight, already_generated_coins, base_reward, version)) + uint64_t median_weight; + if (version >= HF_VERSION_EFFECTIVE_SHORT_TERM_MEDIAN_IN_PENALTY) + { + median_weight = m_current_block_cumul_weight_median; + } + else + { + std::vector<uint64_t> last_blocks_weights; + get_last_n_blocks_weights(last_blocks_weights, CRYPTONOTE_REWARD_BLOCKS_WINDOW); + median_weight = epee::misc_utils::median(last_blocks_weights); + } + if (!get_block_reward(median_weight, cumulative_block_weight, already_generated_coins, base_reward, version)) { MERROR_VER("block weight " << cumulative_block_weight << " is bigger than allowed for this blockchain"); return false; |