Skip to content

Commit 9b0f0c5

Browse files
committed
Add m_ prefix to WalletBatch::m_batch
1 parent 398c6f0 commit 9b0f0c5

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

src/wallet/walletdb.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ bool WalletBatch::WriteBestBlock(const CBlockLocator& locator)
121121

122122
bool WalletBatch::ReadBestBlock(CBlockLocator& locator)
123123
{
124-
if (batch.Read(std::string("bestblock"), locator) && !locator.vHave.empty()) return true;
125-
return batch.Read(std::string("bestblock_nomerkle"), locator);
124+
if (m_batch.Read(std::string("bestblock"), locator) && !locator.vHave.empty()) return true;
125+
return m_batch.Read(std::string("bestblock_nomerkle"), locator);
126126
}
127127

128128
bool WalletBatch::WriteOrderPosNext(int64_t nOrderPosNext)
@@ -132,7 +132,7 @@ bool WalletBatch::WriteOrderPosNext(int64_t nOrderPosNext)
132132

133133
bool WalletBatch::ReadPool(int64_t nPool, CKeyPool& keypool)
134134
{
135-
return batch.Read(std::make_pair(std::string("pool"), nPool), keypool);
135+
return m_batch.Read(std::make_pair(std::string("pool"), nPool), keypool);
136136
}
137137

138138
bool WalletBatch::WritePool(int64_t nPool, const CKeyPool& keypool)
@@ -153,7 +153,7 @@ bool WalletBatch::WriteMinVersion(int nVersion)
153153
bool WalletBatch::ReadAccount(const std::string& strAccount, CAccount& account)
154154
{
155155
account.SetNull();
156-
return batch.Read(std::make_pair(std::string("acc"), strAccount), account);
156+
return m_batch.Read(std::make_pair(std::string("acc"), strAccount), account);
157157
}
158158

159159
bool WalletBatch::WriteAccount(const std::string& strAccount, const CAccount& account)
@@ -182,7 +182,7 @@ void WalletBatch::ListAccountCreditDebit(const std::string& strAccount, std::lis
182182
{
183183
bool fAllAccounts = (strAccount == "*");
184184

185-
Dbc* pcursor = batch.GetCursor();
185+
Dbc* pcursor = m_batch.GetCursor();
186186
if (!pcursor)
187187
throw std::runtime_error(std::string(__func__) + ": cannot create DB cursor");
188188
bool setRange = true;
@@ -193,7 +193,7 @@ void WalletBatch::ListAccountCreditDebit(const std::string& strAccount, std::lis
193193
if (setRange)
194194
ssKey << std::make_pair(std::string("acentry"), std::make_pair((fAllAccounts ? std::string("") : strAccount), uint64_t(0)));
195195
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
196-
int ret = batch.ReadAtCursor(pcursor, ssKey, ssValue, setRange);
196+
int ret = m_batch.ReadAtCursor(pcursor, ssKey, ssValue, setRange);
197197
setRange = false;
198198
if (ret == DB_NOTFOUND)
199199
break;
@@ -527,15 +527,15 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
527527
LOCK(pwallet->cs_wallet);
528528
try {
529529
int nMinVersion = 0;
530-
if (batch.Read((std::string)"minversion", nMinVersion))
530+
if (m_batch.Read((std::string)"minversion", nMinVersion))
531531
{
532532
if (nMinVersion > CLIENT_VERSION)
533533
return DBErrors::TOO_NEW;
534534
pwallet->LoadMinVersion(nMinVersion);
535535
}
536536

537537
// Get cursor
538-
Dbc* pcursor = batch.GetCursor();
538+
Dbc* pcursor = m_batch.GetCursor();
539539
if (!pcursor)
540540
{
541541
LogPrintf("Error getting wallet database cursor\n");
@@ -547,7 +547,7 @@ DBErrors WalletBatch::LoadWallet(CWallet* pwallet)
547547
// Read next record
548548
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
549549
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
550-
int ret = batch.ReadAtCursor(pcursor, ssKey, ssValue);
550+
int ret = m_batch.ReadAtCursor(pcursor, ssKey, ssValue);
551551
if (ret == DB_NOTFOUND)
552552
break;
553553
else if (ret != 0)
@@ -630,14 +630,14 @@ DBErrors WalletBatch::FindWalletTx(std::vector<uint256>& vTxHash, std::vector<CW
630630

631631
try {
632632
int nMinVersion = 0;
633-
if (batch.Read((std::string)"minversion", nMinVersion))
633+
if (m_batch.Read((std::string)"minversion", nMinVersion))
634634
{
635635
if (nMinVersion > CLIENT_VERSION)
636636
return DBErrors::TOO_NEW;
637637
}
638638

639639
// Get cursor
640-
Dbc* pcursor = batch.GetCursor();
640+
Dbc* pcursor = m_batch.GetCursor();
641641
if (!pcursor)
642642
{
643643
LogPrintf("Error getting wallet database cursor\n");
@@ -649,7 +649,7 @@ DBErrors WalletBatch::FindWalletTx(std::vector<uint256>& vTxHash, std::vector<CW
649649
// Read next record
650650
CDataStream ssKey(SER_DISK, CLIENT_VERSION);
651651
CDataStream ssValue(SER_DISK, CLIENT_VERSION);
652-
int ret = batch.ReadAtCursor(pcursor, ssKey, ssValue);
652+
int ret = m_batch.ReadAtCursor(pcursor, ssKey, ssValue);
653653
if (ret == DB_NOTFOUND)
654654
break;
655655
else if (ret != 0)
@@ -834,25 +834,25 @@ bool WalletBatch::WriteHDChain(const CHDChain& chain)
834834

835835
bool WalletBatch::TxnBegin()
836836
{
837-
return batch.TxnBegin();
837+
return m_batch.TxnBegin();
838838
}
839839

840840
bool WalletBatch::TxnCommit()
841841
{
842-
return batch.TxnCommit();
842+
return m_batch.TxnCommit();
843843
}
844844

845845
bool WalletBatch::TxnAbort()
846846
{
847-
return batch.TxnAbort();
847+
return m_batch.TxnAbort();
848848
}
849849

850850
bool WalletBatch::ReadVersion(int& nVersion)
851851
{
852-
return batch.ReadVersion(nVersion);
852+
return m_batch.ReadVersion(nVersion);
853853
}
854854

855855
bool WalletBatch::WriteVersion(int nVersion)
856856
{
857-
return batch.WriteVersion(nVersion);
857+
return m_batch.WriteVersion(nVersion);
858858
}

src/wallet/walletdb.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ class WalletBatch
144144
template <typename K, typename T>
145145
bool WriteIC(const K& key, const T& value, bool fOverwrite = true)
146146
{
147-
if (!batch.Write(key, value, fOverwrite)) {
147+
if (!m_batch.Write(key, value, fOverwrite)) {
148148
return false;
149149
}
150150
m_database.IncrementUpdateCounter();
@@ -154,7 +154,7 @@ class WalletBatch
154154
template <typename K>
155155
bool EraseIC(const K& key)
156156
{
157-
if (!batch.Erase(key)) {
157+
if (!m_batch.Erase(key)) {
158158
return false;
159159
}
160160
m_database.IncrementUpdateCounter();
@@ -163,7 +163,7 @@ class WalletBatch
163163

164164
public:
165165
explicit WalletBatch(WalletDatabase& database, const char* pszMode = "r+", bool _fFlushOnClose = true) :
166-
batch(database, pszMode, _fFlushOnClose),
166+
m_batch(database, pszMode, _fFlushOnClose),
167167
m_database(database)
168168
{
169169
}
@@ -244,7 +244,7 @@ class WalletBatch
244244
//! Write wallet version
245245
bool WriteVersion(int nVersion);
246246
private:
247-
BerkeleyBatch batch;
247+
BerkeleyBatch m_batch;
248248
WalletDatabase& m_database;
249249
};
250250

0 commit comments

Comments
 (0)