Add LevelDB MemEnv support
Support LevelDB memory-backed environments, and use them in unit tests.
This commit is contained in:
@@ -19,7 +19,7 @@ void static BatchWriteHashBestChain(CLevelDBBatch &batch, const uint256 &hash) {
|
||||
batch.Write('B', hash);
|
||||
}
|
||||
|
||||
CCoinsViewDB::CCoinsViewDB() : db(GetDataDir() / "coins") {
|
||||
CCoinsViewDB::CCoinsViewDB(bool fMemory) : db(GetDataDir() / "coins", fMemory) {
|
||||
}
|
||||
|
||||
bool CCoinsViewDB::GetCoins(uint256 txid, CCoins &coins) {
|
||||
@@ -63,6 +63,9 @@ bool CCoinsViewDB::BatchWrite(const std::map<uint256, CCoins> &mapCoins, CBlockI
|
||||
return db.WriteBatch(batch);
|
||||
}
|
||||
|
||||
CBlockTreeDB::CBlockTreeDB(bool fMemory) : CLevelDB(GetDataDir() / "blktree", fMemory) {
|
||||
}
|
||||
|
||||
bool CBlockTreeDB::WriteBlockIndex(const CDiskBlockIndex& blockindex)
|
||||
{
|
||||
return Write(make_pair('b', blockindex.GetBlockHash()), blockindex);
|
||||
|
||||
Reference in New Issue
Block a user