|
@ -104,6 +104,8 @@ public: |
|
|
class BlockChain |
|
|
class BlockChain |
|
|
{ |
|
|
{ |
|
|
public: |
|
|
public: |
|
|
|
|
|
/// Doesn't open the database - if you want it open it's up to you to subclass this and open it
|
|
|
|
|
|
/// in the constructor there.
|
|
|
BlockChain(bytes const& _genesisBlock, StateDefinition const& _genesisState, std::string const& _path, WithExisting _we = WithExisting::Trust, ProgressCallback const& _p = ProgressCallback()); |
|
|
BlockChain(bytes const& _genesisBlock, StateDefinition const& _genesisState, std::string const& _path, WithExisting _we = WithExisting::Trust, ProgressCallback const& _p = ProgressCallback()); |
|
|
~BlockChain(); |
|
|
~BlockChain(); |
|
|
|
|
|
|
|
@ -292,13 +294,20 @@ public: |
|
|
protected: |
|
|
protected: |
|
|
static h256 chunkId(unsigned _level, unsigned _index) { return h256(_index * 0xff + _level); } |
|
|
static h256 chunkId(unsigned _level, unsigned _index) { return h256(_index * 0xff + _level); } |
|
|
|
|
|
|
|
|
/// Initialise everything and open the database.
|
|
|
/// Initialise everything and ready for openning the database.
|
|
|
void open(bytes const& _genesisBlock, std::unordered_map<Address, Account> const& _genesisState, std::string const& _path, WithExisting _we, ProgressCallback const& _p); |
|
|
void open(bytes const& _genesisBlock, std::unordered_map<Address, Account> const& _genesisState, std::string const& _path, WithExisting _we, ProgressCallback const& _p); |
|
|
/// Open the database.
|
|
|
/// Open the database.
|
|
|
unsigned openDatabase(std::string const& _path, WithExisting _we = WithExisting::Trust); |
|
|
unsigned openDatabase(std::string const& _path, WithExisting _we); |
|
|
/// Finalise everything and close the database.
|
|
|
/// Finalise everything and close the database.
|
|
|
void close(); |
|
|
void close(); |
|
|
|
|
|
|
|
|
|
|
|
/// Open the database, rebuilding if necessary.
|
|
|
|
|
|
void openDatabase(std::string const& _path, WithExisting _we, ProgressCallback const& _pc) |
|
|
|
|
|
{ |
|
|
|
|
|
if (openDatabase(_path, _we) != c_minorProtocolVersion || _we == WithExisting::Verify) |
|
|
|
|
|
rebuild(_path, _pc); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
template<class T, class K, unsigned N> T queryExtras(K const& _h, std::unordered_map<K, T>& _m, boost::shared_mutex& _x, T const& _n, ldb::DB* _extrasDB = nullptr) const |
|
|
template<class T, class K, unsigned N> T queryExtras(K const& _h, std::unordered_map<K, T>& _m, boost::shared_mutex& _x, T const& _n, ldb::DB* _extrasDB = nullptr) const |
|
|
{ |
|
|
{ |
|
|
{ |
|
|
{ |
|
|