Skip to content

Commit f8f2ace

Browse files
committed
trivial: use constants for db keys
Replace literal occurances of the key "prefixes" 'c' and 'b' in txdb.cpp by the respective constants.
1 parent a1d623d commit f8f2ace

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/txdb.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ bool CCoinsViewDB::GetStats(CCoinsStats &stats) const {
9999
only need read operations on it, use a const-cast to get around
100100
that restriction. */
101101
boost::scoped_ptr<CLevelDBIterator> pcursor(const_cast<CLevelDBWrapper*>(&db)->NewIterator());
102-
pcursor->Seek('c');
102+
pcursor->Seek(DB_COINS);
103103

104104
CHashWriter ss(SER_GETHASH, PROTOCOL_VERSION);
105105
stats.hashBlock = GetBestBlock();
@@ -109,7 +109,7 @@ bool CCoinsViewDB::GetStats(CCoinsStats &stats) const {
109109
boost::this_thread::interruption_point();
110110
std::pair<char, uint256> key;
111111
CCoins coins;
112-
if (pcursor->GetKey(key) && key.first == 'c') {
112+
if (pcursor->GetKey(key) && key.first == DB_COINS) {
113113
if (pcursor->GetValue(coins)) {
114114
stats.nTransactions++;
115115
for (unsigned int i=0; i<coins.vout.size(); i++) {
@@ -179,13 +179,13 @@ bool CBlockTreeDB::LoadBlockIndexGuts()
179179
{
180180
boost::scoped_ptr<CLevelDBIterator> pcursor(NewIterator());
181181

182-
pcursor->Seek(make_pair('b', uint256()));
182+
pcursor->Seek(make_pair(DB_BLOCK_INDEX, uint256()));
183183

184184
// Load mapBlockIndex
185185
while (pcursor->Valid()) {
186186
boost::this_thread::interruption_point();
187187
std::pair<char, uint256> key;
188-
if (pcursor->GetKey(key) && key.first == 'b') {
188+
if (pcursor->GetKey(key) && key.first == DB_BLOCK_INDEX) {
189189
CDiskBlockIndex diskindex;
190190
if (pcursor->GetValue(diskindex)) {
191191
// Construct block index object

0 commit comments

Comments
 (0)