aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorwarptangent <warptangent@tutanota.com>2016-02-08 08:09:07 -0800
committerwarptangent <warptangent@tutanota.com>2016-02-08 09:28:19 -0800
commite02577f594ecd0a619ef3efaf65de90df9c20289 (patch)
treeeef8fc8e9e68554a5faab9cd2c89a4bc241c5816 /src
parentMake HardFork object available to BlockchainDB and derived DB implementations (diff)
downloadmonero-e02577f594ecd0a619ef3efaf65de90df9c20289.tar.xz
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.
Diffstat (limited to 'src')
-rw-r--r--src/blockchain_db/blockchain_db.cpp1
-rw-r--r--src/blockchain_utilities/blockchain_import.cpp3
-rw-r--r--src/cryptonote_core/blockchain.cpp3
3 files changed, 1 insertions, 6 deletions
diff --git a/src/blockchain_db/blockchain_db.cpp b/src/blockchain_db/blockchain_db.cpp
index 4b05ddf24..270b5399e 100644
--- a/src/blockchain_db/blockchain_db.cpp
+++ b/src/blockchain_db/blockchain_db.cpp
@@ -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
// function returns, so height() here returns the new previous height.
uint64_t prev_height = height();
+ m_hardfork->add(blk, prev_height);
block_txn_stop();
diff --git a/src/blockchain_utilities/blockchain_import.cpp b/src/blockchain_utilities/blockchain_import.cpp
index 7eb493b6d..447d3a21c 100644
--- a/src/blockchain_utilities/blockchain_import.cpp
+++ b/src/blockchain_utilities/blockchain_import.cpp
@@ -469,9 +469,6 @@ int import_from_file(FakeCore& simple_core, const std::string& import_file_path,
try
{
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)
{
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 94ef4b894..6fe998260 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -2692,9 +2692,6 @@ bool Blockchain::handle_block_to_main_chain(const block& bl, const crypto::hash&
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
update_next_cumulative_size_limit();