src/MicroCore.cpp
/**
     * Initialized the MicroCore object.
     *
     * Create BlockchainLMDB on the heap.
     * Open database files located in blockchain_path.
     * Initialize m_blockchain_storage with the BlockchainLMDB object.
     */
Initialized the MicroCore object.
Create BlockchainLMDB on the heap.
Open database files located in blockchain_path.
Initialized the MicroCore object . Create BlockchainLMDB on the heap . Open database files located in blockchain_path .
bool
    MicroCore::init(const string& _blockchain_path)
    {
        int db_flags = 0;
        blockchain_path = _blockchain_path;
        db_flags |= MDB_NOLOCK;
        HardFork* m_hardfork = nullptr;
        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
        {
            db->open(blockchain_path, db_flags);
        }
        catch (const std::exception& e)
        {
            cerr << "Error opening database: " << e.what();
            return false;
        }
        if(!db->is_open())
        {
            return false;
        }
        return m_blockchain_storage.init(db, m_hardfork, network_type::MAINNET);
    }
bool MicroCore :: init ( const string & _blockchain_path ) { int db_flags = 0 ; blockchain_path = _blockchain_path ; db_flags |= MDB_NOLOCK ; HardFork * m_hardfork = nullptr ; 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 { db -> open ( blockchain_path , db_flags ) ; } catch ( const std :: exception & e ) { cerr << " " << e . what ( ) ; return false ; } if ( ! db -> is_open ( ) ) { return false ; } return m_blockchain_storage . init ( db , m_hardfork , network_type :: MAINNET ) ; }
Initialized the MicroCore object.
Initialized the MicroCore object .
//db_flags |= MDB_RDONLY; //db_flags |= MDB_SYNC; // uint64_t DEFAULT_FLAGS = MDB_NOMETASYNC | MDB_NORDAHEAD; //db_flags = DEFAULT_FLAGS; // try opening lmdb database files // check if the blockchain database // is successful opened // initialize Blockchain object to manage // the database.