Add m_ prefix to WalletBatch::m_batch

This commit is contained in:
Russell Yanofsky 2018-03-20 14:48:33 -04:00
parent 398c6f0f9d
commit 9b0f0c5513
2 changed files with 21 additions and 21 deletions

View file

@ -121,8 +121,8 @@ bool WalletBatch::WriteBestBlock(const CBlockLocator& locator)
bool WalletBatch::ReadBestBlock(CBlockLocator& locator)
{
if (batch.Read(std::string("bestblock"), locator) && !locator.vHave.empty()) return true;
return batch.Read(std::string("bestblock_nomerkle"), locator);
if (m_batch.Read(std::string("bestblock"), locator) && !locator.vHave.empty()) return true;
return m_batch.Read(std::string("bestblock_nomerkle"), locator);
}
bool WalletBatch::WriteOrderPosNext(int64_t nOrderPosNext)
@ -132,7 +132,7 @@ bool WalletBatch::WriteOrderPosNext(int64_t nOrderPosNext)
bool WalletBatch::ReadPool(int64_t nPool, CKeyPool& keypool)
{
return batch.Read(std::make_pair(std::string("pool"), nPool), keypool);
return m_batch.Read(std::make_pair(std::string("pool"), nPool), keypool);
}
bool WalletBatch::WritePool(int64_t nPool, const CKeyPool& keypool)
@ -153,7 +153,7 @@ bool WalletBatch::WriteMinVersion(int nVersion)
bool WalletBatch::ReadAccount(const std::string& strAccount, CAccount& account)
{
account.SetNull();
return batch.Read(std::make_pair(std::string("acc"), strAccount), account);
return m_batch.Read(std::make_pair(std::string("acc"), strAccount), account);
}
bool WalletBatch::WriteAccount(const std::string& strAccount, const CAccount& account)
@ -182,7 +182,7 @@ void WalletBatch::ListAccountCreditDebit(const std::string& strAccount, std::lis
{
bool fAllAccounts = (strAccount == "*");
Dbc* pcursor = batch.GetCursor();
Dbc* pcursor = m_batch.GetCursor();
if (!pcursor)
throw std::runtime_error(std::string(__func__) + ": cannot create DB cursor");
bool setRange = true;
@ -193,7 +193,7 @@ void WalletBatch::ListAccountCreditDebit(const std::string& strAccount, std::lis
if (setRange)
ssKey << std::make_pair(std::string("acentry"), std::make_pair((fAllAccounts ? std::string("") : strAccount), uint64_t(0)));
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
int ret = batch.ReadAtCursor(pcursor, ssKey, ssValue, setRange);
int ret = m_batch.ReadAtCursor(pcursor, ssKey, ssValue, setRange);
setRange = false;
if (ret == DB_NOTFOUND)
break;
@ -527,7 +527,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
LOCK(pwallet->cs_wallet);
try {
int nMinVersion = 0;
if (batch.Read((std::string)"minversion", nMinVersion))
if (m_batch.Read((std::string)"minversion", nMinVersion))
{
if (nMinVersion > CLIENT_VERSION)
return DBErrors::TOO_NEW;
@ -535,7 +535,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
}
// Get cursor
Dbc* pcursor = batch.GetCursor();
Dbc* pcursor = m_batch.GetCursor();
if (!pcursor)
{
LogPrintf("Error getting wallet database cursor\n");
@ -547,7 +547,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
// Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
int ret = batch.ReadAtCursor(pcursor, ssKey, ssValue);
int ret = m_batch.ReadAtCursor(pcursor, ssKey, ssValue);
if (ret == DB_NOTFOUND)
break;
else if (ret != 0)
@ -630,14 +630,14 @@ DBErrors WalletBatch::FindWalletTx(std::vector<uint256>& vTxHash, std::vector<CW
try {
int nMinVersion = 0;
if (batch.Read((std::string)"minversion", nMinVersion))
if (m_batch.Read((std::string)"minversion", nMinVersion))
{
if (nMinVersion > CLIENT_VERSION)
return DBErrors::TOO_NEW;
}
// Get cursor
Dbc* pcursor = batch.GetCursor();
Dbc* pcursor = m_batch.GetCursor();
if (!pcursor)
{
LogPrintf("Error getting wallet database cursor\n");
@ -649,7 +649,7 @@ DBErrors WalletBatch::FindWalletTx(std::vector<uint256>& vTxHash, std::vector<CW
// Read next record
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
int ret = batch.ReadAtCursor(pcursor, ssKey, ssValue);
int ret = m_batch.ReadAtCursor(pcursor, ssKey, ssValue);
if (ret == DB_NOTFOUND)
break;
else if (ret != 0)
@ -834,25 +834,25 @@ bool WalletBatch::WriteHDChain(const CHDChain& chain)
bool WalletBatch::TxnBegin()
{
return batch.TxnBegin();
return m_batch.TxnBegin();
}
bool WalletBatch::TxnCommit()
{
return batch.TxnCommit();
return m_batch.TxnCommit();
}
bool WalletBatch::TxnAbort()
{
return batch.TxnAbort();
return m_batch.TxnAbort();
}
bool WalletBatch::ReadVersion(int& nVersion)
{
return batch.ReadVersion(nVersion);
return m_batch.ReadVersion(nVersion);
}
bool WalletBatch::WriteVersion(int nVersion)
{
return batch.WriteVersion(nVersion);
return m_batch.WriteVersion(nVersion);
}

View file

@ -144,7 +144,7 @@ private:
template <typename K, typename T>
bool WriteIC(const K& key, const T& value, bool fOverwrite = true)
{
if (!batch.Write(key, value, fOverwrite)) {
if (!m_batch.Write(key, value, fOverwrite)) {
return false;
}
m_database.IncrementUpdateCounter();
@ -154,7 +154,7 @@ private:
template <typename K>
bool EraseIC(const K& key)
{
if (!batch.Erase(key)) {
if (!m_batch.Erase(key)) {
return false;
}
m_database.IncrementUpdateCounter();
@ -163,7 +163,7 @@ private:
public:
explicit WalletBatch(WalletDatabase& database, const char* pszMode = "r+", bool _fFlushOnClose = true) :
batch(database, pszMode, _fFlushOnClose),
m_batch(database, pszMode, _fFlushOnClose),
m_database(database)
{
}
@ -244,7 +244,7 @@ public:
//! Write wallet version
bool WriteVersion(int nVersion);
private:
BerkeleyBatch batch;
BerkeleyBatch m_batch;
WalletDatabase& m_database;
};