mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-30 04:32:21 +02:00
move-only(ish): don't expose CCoinsViewDBCursor
No need for this to be a part of the header anymore. Includes a small reference type style change.
This commit is contained in:
parent
615c1adfb0
commit
0f8a5a4dd5
22
src/txdb.cpp
22
src/txdb.cpp
@ -168,6 +168,28 @@ bool CBlockTreeDB::ReadLastBlockFile(int &nFile) {
|
||||
return Read(DB_LAST_BLOCK, nFile);
|
||||
}
|
||||
|
||||
/** Specialization of CCoinsViewCursor to iterate over a CCoinsViewDB */
|
||||
class CCoinsViewDBCursor: public CCoinsViewCursor
|
||||
{
|
||||
public:
|
||||
CCoinsViewDBCursor(CDBIterator* pcursorIn, const uint256&hashBlockIn):
|
||||
CCoinsViewCursor(hashBlockIn), pcursor(pcursorIn) {}
|
||||
~CCoinsViewDBCursor() {}
|
||||
|
||||
bool GetKey(COutPoint &key) const override;
|
||||
bool GetValue(Coin &coin) const override;
|
||||
unsigned int GetValueSize() const override;
|
||||
|
||||
bool Valid() const override;
|
||||
void Next() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<CDBIterator> pcursor;
|
||||
std::pair<char, COutPoint> keyTmp;
|
||||
|
||||
friend class CCoinsViewDB;
|
||||
};
|
||||
|
||||
std::unique_ptr<CCoinsViewCursor> CCoinsViewDB::Cursor() const
|
||||
{
|
||||
auto i = std::make_unique<CCoinsViewDBCursor>(
|
||||
|
22
src/txdb.h
22
src/txdb.h
@ -70,28 +70,6 @@ public:
|
||||
void ResizeCache(size_t new_cache_size) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
|
||||
};
|
||||
|
||||
/** Specialization of CCoinsViewCursor to iterate over a CCoinsViewDB */
|
||||
class CCoinsViewDBCursor: public CCoinsViewCursor
|
||||
{
|
||||
public:
|
||||
CCoinsViewDBCursor(CDBIterator* pcursorIn, const uint256 &hashBlockIn):
|
||||
CCoinsViewCursor(hashBlockIn), pcursor(pcursorIn) {}
|
||||
~CCoinsViewDBCursor() {}
|
||||
|
||||
bool GetKey(COutPoint &key) const override;
|
||||
bool GetValue(Coin &coin) const override;
|
||||
unsigned int GetValueSize() const override;
|
||||
|
||||
bool Valid() const override;
|
||||
void Next() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<CDBIterator> pcursor;
|
||||
std::pair<char, COutPoint> keyTmp;
|
||||
|
||||
friend class CCoinsViewDB;
|
||||
};
|
||||
|
||||
/** Access to the block database (blocks/index/) */
|
||||
class CBlockTreeDB : public CDBWrapper
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user