blockchain_utilities: Have fake_core create HardFork object

The HardFork object is needed for the importer to update the hard fork
data when verify mode is off.
This commit is contained in:
warptangent 2016-02-04 23:20:48 -08:00
parent 8f863e742d
commit 7006b2ebe1
No known key found for this signature in database
GPG Key ID: 0E490BEBFBE4E92D
1 changed files with 13 additions and 1 deletions

View File

@ -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;
@ -77,7 +86,10 @@ struct fake_core_lmdb
db->check_hard_fork_info();
m_storage.init(db, use_testnet);
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);