aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-01-01 18:26:46 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-01-01 18:28:01 +0000
commit5ee6f03742f7c14059da6139a9923c443668f4b0 (patch)
tree55d5c01dbf3632c66d447477783dc37e6d807efc /src/cryptonote_core/blockchain.cpp
parentblockchain: use the version passed as parameter, not a new one (diff)
downloadmonero-5ee6f03742f7c14059da6139a9923c443668f4b0.tar.xz
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
Diffstat (limited to 'src/cryptonote_core/blockchain.cpp')
-rw-r--r--src/cryptonote_core/blockchain.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index c6fa35270..7ed5d74a9 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -641,6 +641,9 @@ block Blockchain::pop_block_from_blockchain()
throw;
}
+ // make sure the hard fork object updates its current version
+ m_hardfork->on_block_popped(1);
+
// return transactions from popped block to the tx_pool
for (transaction& tx : popped_txs)
{
@@ -651,12 +654,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,