blockchain: fix wrong hf version when popping multiple blocks

Since we keep track of the hf version in the db, we pick it up
from there instead of doing the full reorg call, which is quite
expensive
This commit is contained in:
moneromooo-monero 2019-01-01 18:26:46 +00:00
parent 1c7650f416
commit b84b350fd4
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
3 changed files with 37 additions and 6 deletions

View file

@ -619,6 +619,9 @@ block Blockchain::pop_block_from_blockchain()
throw;
}
// make sure the hard fork object updates its current version
m_hardfork->on_block_popped(1);
pop_from_long_term_block_weights();
// return transactions from popped block to the tx_pool
@ -631,12 +634,7 @@ block Blockchain::pop_block_from_blockchain()
// FIXME: HardFork
// Besides the below, popping a block should also remove the last entry
// in hf_versions.
//
// FIXME: HardFork
// This is not quite correct, as we really want to add the txes
// to the pool based on the version determined after all blocks
// are popped.
uint8_t version = get_current_hard_fork_version();
uint8_t version = get_ideal_hard_fork_version(m_db->height());
// We assume that if they were in a block, the transactions are already
// known to the network as a whole. However, if we had mined that block,