aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_utilities/fake_core.h
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2016-02-08 18:55:58 +0200
committerRiccardo Spagni <ric@spagni.net>2016-02-08 18:55:58 +0200
commit50197b62a333b51fcbd318cf2e53220a9c7d744f (patch)
treed7f2a08aa4cccbb8d9e038ff047e5ca3bea8eae2 /src/blockchain_utilities/fake_core.h
parentMerge pull request #648 (diff)
parentblockchain_import: Add hard fork data for each block when verify mode is off (diff)
downloadmonero-50197b62a333b51fcbd318cf2e53220a9c7d744f.tar.xz
Merge pull request #644
9d62c16 blockchain_import: Add hard fork data for each block when verify mode is off (warptangent) 7006b2e blockchain_utilities: Have fake_core create HardFork object (warptangent) 8f863e7 Blockchain: Optionally pass in HardFork object (warptangent) f7e337e fake_core: Check if hard fork subdbs need reset at start (warptangent) c657e77 blockchain_import: Add --drop-hard-fork command (warptangent) 4122439 blockchain_import: Add exception to log output (warptangent)
Diffstat (limited to 'src/blockchain_utilities/fake_core.h')
-rw-r--r--src/blockchain_utilities/fake_core.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/blockchain_utilities/fake_core.h b/src/blockchain_utilities/fake_core.h
index 245d535fc..29f34026d 100644
--- a/src/blockchain_utilities/fake_core.h
+++ b/src/blockchain_utilities/fake_core.h
@@ -36,12 +36,21 @@
using namespace cryptonote;
+namespace
+{
+ // NOTE: These values should match blockchain.cpp
+ // TODO: Refactor
+ const uint64_t mainnet_hard_fork_version_1_till = 1009826;
+ const uint64_t testnet_hard_fork_version_1_till = 624633;
+}
+
#if !defined(BLOCKCHAIN_DB) || BLOCKCHAIN_DB == DB_LMDB
struct fake_core_lmdb
{
Blockchain m_storage;
+ HardFork* m_hardfork = nullptr;
tx_memory_pool m_pool;
bool support_batch;
bool support_add_block;
@@ -75,7 +84,13 @@ struct fake_core_lmdb
throw;
}
- m_storage.init(db, use_testnet);
+ db->check_hard_fork_info();
+
+ uint64_t hard_fork_version_1_till = use_testnet ? testnet_hard_fork_version_1_till : mainnet_hard_fork_version_1_till;
+ m_hardfork = new HardFork(*db, 1, hard_fork_version_1_till);
+
+ m_storage.init(db, m_hardfork, use_testnet);
+
if (do_batch)
m_storage.get_db().set_batch_transactions(do_batch);
support_batch = true;