mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 07:52:25 +00:00
Move HardFork DB update to BlockchainDB::add_block()
Ensures the database is consistent. Also simplifes blockchain_import in that verify mode off has less to work around.
This commit is contained in:
parent
3800875406
commit
e02577f594
3 changed files with 1 additions and 6 deletions
|
@ -130,6 +130,7 @@ uint64_t BlockchainDB::add_block( const block& blk
|
||||||
// DB's new height based on this added block is only incremented after this
|
// DB's new height based on this added block is only incremented after this
|
||||||
// function returns, so height() here returns the new previous height.
|
// function returns, so height() here returns the new previous height.
|
||||||
uint64_t prev_height = height();
|
uint64_t prev_height = height();
|
||||||
|
m_hardfork->add(blk, prev_height);
|
||||||
|
|
||||||
block_txn_stop();
|
block_txn_stop();
|
||||||
|
|
||||||
|
|
|
@ -469,9 +469,6 @@ int import_from_file(FakeCore& simple_core, const std::string& import_file_path,
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
simple_core.add_block(b, block_size, cumulative_difficulty, coins_generated, txs);
|
simple_core.add_block(b, block_size, cumulative_difficulty, coins_generated, txs);
|
||||||
#if !defined(BLOCKCHAIN_DB) || (BLOCKCHAIN_DB == DB_LMDB)
|
|
||||||
simple_core.m_hardfork->add(b, h-1);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2692,9 +2692,6 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash&
|
||||||
|
|
||||||
TIME_MEASURE_FINISH(addblock);
|
TIME_MEASURE_FINISH(addblock);
|
||||||
|
|
||||||
// this will not fail since check succeeded above
|
|
||||||
m_hardfork->add(bl, new_height - 1);
|
|
||||||
|
|
||||||
// do this after updating the hard fork state since the size limit may change due to fork
|
// do this after updating the hard fork state since the size limit may change due to fork
|
||||||
update_next_cumulative_size_limit();
|
update_next_cumulative_size_limit();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue