Skip to content

Commit f697c06

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#25438: refactor: remove unused methods in classes CDBIterator,CDBWrapper,CCoinsViewDBCursor
e4b4db5 refactor: remove unused method `CDBWrapper::CompactRange` (Sebastian Falbesoner) fb38c6e refactor: remove unused methods `{CDBIterator,CCoinsViewDBCursor}::GetValueSize()` (Sebastian Falbesoner) Pull request description: The `GetValueSize` methods haven't been used since the chainstate db cache has been switched from per-tx to per-txout model years ago (PR #10195, commit d342424). The `CompactRange` is unused since the txindex migration code was removed (PR bitcoin/bitcoin#22626, commit bitcoin/bitcoin@fa20f81). ACKs for top commit: fanquake: ACK e4b4db5 furszy: re-ACK e4b4db5 laanwj: Code review ACK e4b4db5 Tree-SHA512: 77da445fb70c744046263c6f2ddb05782b68e3d4b2ea604dd7c7dc73ce7c1f2d2b48ec68db4dcb03e35fc27488b99b0a420f6fa3d5b83d325c1708ed68e99e0a
2 parents 2598720 + e4b4db5 commit f697c06

File tree

3 files changed

+0
-28
lines changed

3 files changed

+0
-28
lines changed

src/coins.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ class CCoinsViewCursor
142142

143143
virtual bool GetKey(COutPoint &key) const = 0;
144144
virtual bool GetValue(Coin &coin) const = 0;
145-
virtual unsigned int GetValueSize() const = 0;
146145

147146
virtual bool Valid() const = 0;
148147
virtual void Next() = 0;

src/dbwrapper.h

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,6 @@ class CDBIterator
166166
}
167167
return true;
168168
}
169-
170-
unsigned int GetValueSize() {
171-
return piter->value().size();
172-
}
173-
174169
};
175170

176171
class CDBWrapper
@@ -318,22 +313,6 @@ class CDBWrapper
318313
pdb->GetApproximateSizes(&range, 1, &size);
319314
return size;
320315
}
321-
322-
/**
323-
* Compact a certain range of keys in the database.
324-
*/
325-
template<typename K>
326-
void CompactRange(const K& key_begin, const K& key_end) const
327-
{
328-
CDataStream ssKey1(SER_DISK, CLIENT_VERSION), ssKey2(SER_DISK, CLIENT_VERSION);
329-
ssKey1.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
330-
ssKey2.reserve(DBWRAPPER_PREALLOC_KEY_SIZE);
331-
ssKey1 << key_begin;
332-
ssKey2 << key_end;
333-
leveldb::Slice slKey1((const char*)ssKey1.data(), ssKey1.size());
334-
leveldb::Slice slKey2((const char*)ssKey2.data(), ssKey2.size());
335-
pdb->CompactRange(&slKey1, &slKey2);
336-
}
337316
};
338317

339318
#endif // BITCOIN_DBWRAPPER_H

src/txdb.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,6 @@ class CCoinsViewDBCursor: public CCoinsViewCursor
211211

212212
bool GetKey(COutPoint &key) const override;
213213
bool GetValue(Coin &coin) const override;
214-
unsigned int GetValueSize() const override;
215214

216215
bool Valid() const override;
217216
void Next() override;
@@ -257,11 +256,6 @@ bool CCoinsViewDBCursor::GetValue(Coin &coin) const
257256
return pcursor->GetValue(coin);
258257
}
259258

260-
unsigned int CCoinsViewDBCursor::GetValueSize() const
261-
{
262-
return pcursor->GetValueSize();
263-
}
264-
265259
bool CCoinsViewDBCursor::Valid() const
266260
{
267261
return keyTmp.first == DB_COIN;

0 commit comments

Comments
 (0)