Skip to content

Commit 0f8a5a4

Browse files
committed
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.
1 parent 615c1ad commit 0f8a5a4

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

src/txdb.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,28 @@ bool CBlockTreeDB::ReadLastBlockFile(int &nFile) {
168168
return Read(DB_LAST_BLOCK, nFile);
169169
}
170170

171+
/** Specialization of CCoinsViewCursor to iterate over a CCoinsViewDB */
172+
class CCoinsViewDBCursor: public CCoinsViewCursor
173+
{
174+
public:
175+
CCoinsViewDBCursor(CDBIterator* pcursorIn, const uint256&hashBlockIn):
176+
CCoinsViewCursor(hashBlockIn), pcursor(pcursorIn) {}
177+
~CCoinsViewDBCursor() {}
178+
179+
bool GetKey(COutPoint &key) const override;
180+
bool GetValue(Coin &coin) const override;
181+
unsigned int GetValueSize() const override;
182+
183+
bool Valid() const override;
184+
void Next() override;
185+
186+
private:
187+
std::unique_ptr<CDBIterator> pcursor;
188+
std::pair<char, COutPoint> keyTmp;
189+
190+
friend class CCoinsViewDB;
191+
};
192+
171193
std::unique_ptr<CCoinsViewCursor> CCoinsViewDB::Cursor() const
172194
{
173195
auto i = std::make_unique<CCoinsViewDBCursor>(

src/txdb.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -70,28 +70,6 @@ class CCoinsViewDB final : public CCoinsView
7070
void ResizeCache(size_t new_cache_size) EXCLUSIVE_LOCKS_REQUIRED(cs_main);
7171
};
7272

73-
/** Specialization of CCoinsViewCursor to iterate over a CCoinsViewDB */
74-
class CCoinsViewDBCursor: public CCoinsViewCursor
75-
{
76-
public:
77-
CCoinsViewDBCursor(CDBIterator* pcursorIn, const uint256 &hashBlockIn):
78-
CCoinsViewCursor(hashBlockIn), pcursor(pcursorIn) {}
79-
~CCoinsViewDBCursor() {}
80-
81-
bool GetKey(COutPoint &key) const override;
82-
bool GetValue(Coin &coin) const override;
83-
unsigned int GetValueSize() const override;
84-
85-
bool Valid() const override;
86-
void Next() override;
87-
88-
private:
89-
std::unique_ptr<CDBIterator> pcursor;
90-
std::pair<char, COutPoint> keyTmp;
91-
92-
friend class CCoinsViewDB;
93-
};
94-
9573
/** Access to the block database (blocks/index/) */
9674
class CBlockTreeDB : public CDBWrapper
9775
{

0 commit comments

Comments
 (0)