aboutsummaryrefslogtreecommitdiff
path: root/src/txdb.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-04-20 11:46:01 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-04-23 09:32:25 +0200
commitb69836d6ff2bd7dc9568ad4af8235662bb4f1826 (patch)
tree75aaeee173452ebde6ce70be705f02eba3c3c712 /src/txdb.cpp
parent878bf480a3875181712a53a1156754faa19e579b (diff)
downloadbitcoin-b69836d6ff2bd7dc9568ad4af8235662bb4f1826.tar.xz
dbwrapper: Pass parent CDBWrapper into CDBBatch and CDBIterator
Pass parent wrapper directly instead of obfuscation key. This makes it possible for other databases which re-use this code to use other properties from the database. Add a namespace dbwrapper_private for private functions to be used only in dbwrapper.h/cpp and dbwrapper_tests.
Diffstat (limited to 'src/txdb.cpp')
-rw-r--r--src/txdb.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/txdb.cpp b/src/txdb.cpp
index 19ca178654..5fbaeb608a 100644
--- a/src/txdb.cpp
+++ b/src/txdb.cpp
@@ -49,7 +49,7 @@ uint256 CCoinsViewDB::GetBestBlock() const {
}
bool CCoinsViewDB::BatchWrite(CCoinsMap &mapCoins, const uint256 &hashBlock) {
- CDBBatch batch(&db.GetObfuscateKey());
+ CDBBatch batch(db);
size_t count = 0;
size_t changed = 0;
for (CCoinsMap::iterator it = mapCoins.begin(); it != mapCoins.end();) {
@@ -139,7 +139,7 @@ void CCoinsViewDBCursor::Next()
}
bool CBlockTreeDB::WriteBatchSync(const std::vector<std::pair<int, const CBlockFileInfo*> >& fileInfo, int nLastFile, const std::vector<const CBlockIndex*>& blockinfo) {
- CDBBatch batch(&GetObfuscateKey());
+ CDBBatch batch(*this);
for (std::vector<std::pair<int, const CBlockFileInfo*> >::const_iterator it=fileInfo.begin(); it != fileInfo.end(); it++) {
batch.Write(make_pair(DB_BLOCK_FILES, it->first), *it->second);
}
@@ -155,7 +155,7 @@ bool CBlockTreeDB::ReadTxIndex(const uint256 &txid, CDiskTxPos &pos) {
}
bool CBlockTreeDB::WriteTxIndex(const std::vector<std::pair<uint256, CDiskTxPos> >&vect) {
- CDBBatch batch(&GetObfuscateKey());
+ CDBBatch batch(*this);
for (std::vector<std::pair<uint256,CDiskTxPos> >::const_iterator it=vect.begin(); it!=vect.end(); it++)
batch.Write(make_pair(DB_TXINDEX, it->first), it->second);
return WriteBatch(batch);