mirror of
https://github.com/jwinterm/aeon.git
synced 2026-11-18 09:23:54 +01:00
properly scale block reward for block target
This commit is contained in:
@@ -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<size_t> 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");
|
||||
|
||||
Reference in New Issue
Block a user