Add m_ prefix to WalletBatch::m_batch
This commit is contained in:
parent
398c6f0f9d
commit
9b0f0c5513
2 changed files with 21 additions and 21 deletions
|
@ -121,8 +121,8 @@ bool WalletBatch::WriteBestBlock(const CBlockLocator& locator)
|
||||||
|
|
||||||
bool WalletBatch::ReadBestBlock(CBlockLocator& locator)
|
bool WalletBatch::ReadBestBlock(CBlockLocator& locator)
|
||||||
{
|
{
|
||||||
if (batch.Read(std::string("bestblock"), locator) && !locator.vHave.empty()) return true;
|
if (m_batch.Read(std::string("bestblock"), locator) && !locator.vHave.empty()) return true;
|
||||||
return batch.Read(std::string("bestblock_nomerkle"), locator);
|
return m_batch.Read(std::string("bestblock_nomerkle"), locator);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WalletBatch::WriteOrderPosNext(int64_t nOrderPosNext)
|
bool WalletBatch::WriteOrderPosNext(int64_t nOrderPosNext)
|
||||||
|
@ -132,7 +132,7 @@ bool WalletBatch::WriteOrderPosNext(int64_t nOrderPosNext)
|
||||||
|
|
||||||
bool WalletBatch::ReadPool(int64_t nPool, CKeyPool& keypool)
|
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)
|
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)
|
bool WalletBatch::ReadAccount(const std::string& strAccount, CAccount& account)
|
||||||
{
|
{
|
||||||
account.SetNull();
|
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)
|
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 == "*");
|
bool fAllAccounts = (strAccount == "*");
|
||||||
|
|
||||||
Dbc* pcursor = batch.GetCursor();
|
Dbc* pcursor = m_batch.GetCursor();
|
||||||
if (!pcursor)
|
if (!pcursor)
|
||||||
throw std::runtime_error(std::string(__func__) + ": cannot create DB cursor");
|
throw std::runtime_error(std::string(__func__) + ": cannot create DB cursor");
|
||||||
bool setRange = true;
|
bool setRange = true;
|
||||||
|
@ -193,7 +193,7 @@ void WalletBatch::ListAccountCreditDebit(const std::string& strAccount, std::lis
|
||||||
if (setRange)
|
if (setRange)
|
||||||
ssKey << std::make_pair(std::string("acentry"), std::make_pair((fAllAccounts ? std::string("") : strAccount), uint64_t(0)));
|
ssKey << std::make_pair(std::string("acentry"), std::make_pair((fAllAccounts ? std::string("") : strAccount), uint64_t(0)));
|
||||||
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
|
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;
|
setRange = false;
|
||||||
if (ret == DB_NOTFOUND)
|
if (ret == DB_NOTFOUND)
|
||||||
break;
|
break;
|
||||||
|
@ -527,7 +527,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
|
||||||
LOCK(pwallet->cs_wallet);
|
LOCK(pwallet->cs_wallet);
|
||||||
try {
|
try {
|
||||||
int nMinVersion = 0;
|
int nMinVersion = 0;
|
||||||
if (batch.Read((std::string)"minversion", nMinVersion))
|
if (m_batch.Read((std::string)"minversion", nMinVersion))
|
||||||
{
|
{
|
||||||
if (nMinVersion > CLIENT_VERSION)
|
if (nMinVersion > CLIENT_VERSION)
|
||||||
return DBErrors::TOO_NEW;
|
return DBErrors::TOO_NEW;
|
||||||
|
@ -535,7 +535,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get cursor
|
// Get cursor
|
||||||
Dbc* pcursor = batch.GetCursor();
|
Dbc* pcursor = m_batch.GetCursor();
|
||||||
if (!pcursor)
|
if (!pcursor)
|
||||||
{
|
{
|
||||||
LogPrintf("Error getting wallet database cursor\n");
|
LogPrintf("Error getting wallet database cursor\n");
|
||||||
|
@ -547,7 +547,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
|
||||||
// Read next record
|
// Read next record
|
||||||
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
|
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
|
||||||
CDataStream ssValue(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)
|
if (ret == DB_NOTFOUND)
|
||||||
break;
|
break;
|
||||||
else if (ret != 0)
|
else if (ret != 0)
|
||||||
|
@ -630,14 +630,14 @@ DBErrors WalletBatch::FindWalletTx(std::vector<uint256>& vTxHash, std::vector<CW
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int nMinVersion = 0;
|
int nMinVersion = 0;
|
||||||
if (batch.Read((std::string)"minversion", nMinVersion))
|
if (m_batch.Read((std::string)"minversion", nMinVersion))
|
||||||
{
|
{
|
||||||
if (nMinVersion > CLIENT_VERSION)
|
if (nMinVersion > CLIENT_VERSION)
|
||||||
return DBErrors::TOO_NEW;
|
return DBErrors::TOO_NEW;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get cursor
|
// Get cursor
|
||||||
Dbc* pcursor = batch.GetCursor();
|
Dbc* pcursor = m_batch.GetCursor();
|
||||||
if (!pcursor)
|
if (!pcursor)
|
||||||
{
|
{
|
||||||
LogPrintf("Error getting wallet database cursor\n");
|
LogPrintf("Error getting wallet database cursor\n");
|
||||||
|
@ -649,7 +649,7 @@ DBErrors WalletBatch::FindWalletTx(std::vector<uint256>& vTxHash, std::vector<CW
|
||||||
// Read next record
|
// Read next record
|
||||||
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
|
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
|
||||||
CDataStream ssValue(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)
|
if (ret == DB_NOTFOUND)
|
||||||
break;
|
break;
|
||||||
else if (ret != 0)
|
else if (ret != 0)
|
||||||
|
@ -834,25 +834,25 @@ bool WalletBatch::WriteHDChain(const CHDChain& chain)
|
||||||
|
|
||||||
bool WalletBatch::TxnBegin()
|
bool WalletBatch::TxnBegin()
|
||||||
{
|
{
|
||||||
return batch.TxnBegin();
|
return m_batch.TxnBegin();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WalletBatch::TxnCommit()
|
bool WalletBatch::TxnCommit()
|
||||||
{
|
{
|
||||||
return batch.TxnCommit();
|
return m_batch.TxnCommit();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WalletBatch::TxnAbort()
|
bool WalletBatch::TxnAbort()
|
||||||
{
|
{
|
||||||
return batch.TxnAbort();
|
return m_batch.TxnAbort();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WalletBatch::ReadVersion(int& nVersion)
|
bool WalletBatch::ReadVersion(int& nVersion)
|
||||||
{
|
{
|
||||||
return batch.ReadVersion(nVersion);
|
return m_batch.ReadVersion(nVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WalletBatch::WriteVersion(int nVersion)
|
bool WalletBatch::WriteVersion(int nVersion)
|
||||||
{
|
{
|
||||||
return batch.WriteVersion(nVersion);
|
return m_batch.WriteVersion(nVersion);
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ private:
|
||||||
template <typename K, typename T>
|
template <typename K, typename T>
|
||||||
bool WriteIC(const K& key, const T& value, bool fOverwrite = true)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
m_database.IncrementUpdateCounter();
|
m_database.IncrementUpdateCounter();
|
||||||
|
@ -154,7 +154,7 @@ private:
|
||||||
template <typename K>
|
template <typename K>
|
||||||
bool EraseIC(const K& key)
|
bool EraseIC(const K& key)
|
||||||
{
|
{
|
||||||
if (!batch.Erase(key)) {
|
if (!m_batch.Erase(key)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_database.IncrementUpdateCounter();
|
m_database.IncrementUpdateCounter();
|
||||||
|
@ -163,7 +163,7 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit WalletBatch(WalletDatabase& database, const char* pszMode = "r+", bool _fFlushOnClose = true) :
|
explicit WalletBatch(WalletDatabase& database, const char* pszMode = "r+", bool _fFlushOnClose = true) :
|
||||||
batch(database, pszMode, _fFlushOnClose),
|
m_batch(database, pszMode, _fFlushOnClose),
|
||||||
m_database(database)
|
m_database(database)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ public:
|
||||||
//! Write wallet version
|
//! Write wallet version
|
||||||
bool WriteVersion(int nVersion);
|
bool WriteVersion(int nVersion);
|
||||||
private:
|
private:
|
||||||
BerkeleyBatch batch;
|
BerkeleyBatch m_batch;
|
||||||
WalletDatabase& m_database;
|
WalletDatabase& m_database;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue