diff --git a/README.md b/README.md index 19be3ee..90c6376 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ Alternative block explorers: - [http://moneroblocks.info](http://moneroblocks.info/) - [https://monerobase.com](https://monerobase.com/) +- [https://monerovision.com](https://monerovision.com) - [http://chainradar.com](http://chainradar.com/xmr/blocks) diff --git a/main.cpp b/main.cpp index 5c4620c..5b89673 100644 --- a/main.cpp +++ b/main.cpp @@ -158,7 +158,7 @@ main(int ac, const char* av[]) // initialize mcore and core_storage if (!xmreg::init_blockchain(blockchain_path.string(), - mcore, core_storage)) + mcore, core_storage, nettype)) { cerr << "Error accessing blockchain." << endl; return EXIT_FAILURE; diff --git a/src/MicroCore.cpp b/src/MicroCore.cpp index 2ede97f..06237d5 100644 --- a/src/MicroCore.cpp +++ b/src/MicroCore.cpp @@ -45,31 +45,20 @@ MicroCore::MicroCore(): * Initialize m_blockchain_storage with the BlockchainLMDB object. */ bool -MicroCore::init(const string& _blockchain_path) +MicroCore::init(const string& _blockchain_path, network_type nt) { int db_flags = 0; blockchain_path = _blockchain_path; - //db_flags |= MDB_RDONLY; - db_flags |= MDB_NOLOCK; - //db_flags |= MDB_SYNC; - - // uint64_t DEFAULT_FLAGS = MDB_NOMETASYNC | MDB_NORDAHEAD; - - //db_flags = DEFAULT_FLAGS; + nettype = nt; - HardFork* m_hardfork = nullptr; + db_flags |= MDB_RDONLY; + db_flags |= MDB_NOLOCK; BlockchainDB* db = nullptr; db = new BlockchainLMDB(); - bool use_testnet {false}; - - 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); - try { // try opening lmdb database files @@ -84,13 +73,11 @@ MicroCore::init(const string& _blockchain_path) // check if the blockchain database // is successful opened if(!db->is_open()) - { return false; - } // initialize Blockchain object to manage // the database. - return m_blockchain_storage.init(db, m_hardfork, network_type::MAINNET); + return m_blockchain_storage.init(db, nettype); } /** @@ -337,11 +324,12 @@ MicroCore::~MicroCore() bool init_blockchain(const string& path, MicroCore& mcore, - Blockchain*& core_storage) + Blockchain*& core_storage, + network_type nt) { // initialize the core using the blockchain path - if (!mcore.init(path)) + if (!mcore.init(path, nt)) { cerr << "Error accessing blockchain." << endl; return false; diff --git a/src/MicroCore.h b/src/MicroCore.h index 59f4607..21f9658 100644 --- a/src/MicroCore.h +++ b/src/MicroCore.h @@ -33,11 +33,13 @@ namespace xmreg hw::device* m_device; + network_type nettype; + public: MicroCore(); bool - init(const string& _blockchain_path); + init(const string& _blockchain_path, network_type nt); Blockchain& get_core(); @@ -77,11 +79,11 @@ namespace xmreg - bool init_blockchain(const string& path, MicroCore& mcore, - Blockchain*& core_storage); + Blockchain*& core_storage, + network_type nt); }