walletdb: Add MakeBatch function to BerkeleyDatabase and use it

Instead of having WalletBatch construct the BerkeleyBatch, have
BerkeleyDatabase do it and return a std::unique_ptr<BerkeleyBatch>
This commit is contained in:
Andrew Chow
2020-06-15 16:54:58 -04:00
parent eac9200814
commit b82f0ca4d5
4 changed files with 35 additions and 25 deletions

View File

@@ -841,3 +841,8 @@ bool BerkeleyBatch::HasKey(CDataStream&& key)
int ret = pdb->exists(activeTxn, datKey, 0);
return ret == 0;
}
std::unique_ptr<BerkeleyBatch> BerkeleyDatabase::MakeBatch(const char* mode, bool flush_on_close)
{
return MakeUnique<BerkeleyBatch>(*this, mode, flush_on_close);
}