Merge pull request #5149
7aa0cc58
blockchain: fix m_long_term_block_weight_height initialization (moneromooo-monero)
This commit is contained in:
commit
cf27e26beb
|
@ -514,10 +514,10 @@ bool Blockchain::init(BlockchainDB* db, const network_type nettype, bool offline
|
||||||
{
|
{
|
||||||
m_long_term_block_weights.push_front(db_height - 1 - m_long_term_block_weights.size());
|
m_long_term_block_weights.push_front(db_height - 1 - m_long_term_block_weights.size());
|
||||||
}
|
}
|
||||||
if (!m_long_term_block_weights.empty())
|
m_long_term_block_weights_height = db_height;
|
||||||
m_long_term_block_weights.pop_back();
|
|
||||||
|
|
||||||
update_next_cumulative_weight_limit();
|
if (!update_next_cumulative_weight_limit())
|
||||||
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
@ -666,7 +666,8 @@ block Blockchain::pop_block_from_blockchain()
|
||||||
m_blocks_txs_check.clear();
|
m_blocks_txs_check.clear();
|
||||||
m_check_txin_table.clear();
|
m_check_txin_table.clear();
|
||||||
|
|
||||||
update_next_cumulative_weight_limit();
|
CHECK_AND_ASSERT_THROW_MES(update_next_cumulative_weight_limit(), "Error updating next cumulative weight limit");
|
||||||
|
|
||||||
m_tx_pool.on_blockchain_dec(m_db->height()-1, get_tail_id());
|
m_tx_pool.on_blockchain_dec(m_db->height()-1, get_tail_id());
|
||||||
invalidate_block_template_cache();
|
invalidate_block_template_cache();
|
||||||
|
|
||||||
|
@ -687,7 +688,8 @@ bool Blockchain::reset_and_set_genesis_block(const block& b)
|
||||||
|
|
||||||
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
block_verification_context bvc = boost::value_initialized<block_verification_context>();
|
||||||
add_new_block(b, bvc);
|
add_new_block(b, bvc);
|
||||||
update_next_cumulative_weight_limit();
|
if (!update_next_cumulative_weight_limit())
|
||||||
|
return false;
|
||||||
return bvc.m_added_to_main_chain && !bvc.m_verifivation_failed;
|
return bvc.m_added_to_main_chain && !bvc.m_verifivation_failed;
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------
|
//------------------------------------------------------------------
|
||||||
|
@ -3605,7 +3607,12 @@ leave:
|
||||||
TIME_MEASURE_FINISH(addblock);
|
TIME_MEASURE_FINISH(addblock);
|
||||||
|
|
||||||
// do this after updating the hard fork state since the weight limit may change due to fork
|
// do this after updating the hard fork state since the weight limit may change due to fork
|
||||||
update_next_cumulative_weight_limit();
|
if (!update_next_cumulative_weight_limit())
|
||||||
|
{
|
||||||
|
MERROR("Failed to update next cumulative weight limit");
|
||||||
|
pop_block_from_blockchain();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
MINFO("+++++ 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_weight: " << coinbase_weight << ", cumulative weight: " << cumulative_block_weight << ", " << block_processing_time << "(" << target_calculating_time << "/" << longhash_calculating_time << ")ms");
|
MINFO("+++++ 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_weight: " << coinbase_weight << ", cumulative weight: " << cumulative_block_weight << ", " << block_processing_time << "(" << target_calculating_time << "/" << longhash_calculating_time << ")ms");
|
||||||
if(m_show_time_stats)
|
if(m_show_time_stats)
|
||||||
|
|
Loading…
Reference in New Issue