MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / Cursor

Method Cursor

src/txdb.cpp:172–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172CCoinsViewCursor *CCoinsViewDB::Cursor() const
173{
174 CCoinsViewDBCursor *i = new CCoinsViewDBCursor(const_cast<CDBWrapper&>(db).NewIterator(), GetBestBlock());
175 /* It seems that there are no "const iterators" for LevelDB. Since we
176 only need read operations on it, use a const-cast to get around
177 that restriction. */
178 i->pcursor->Seek(DB_COIN);
179 // Cache key of first record
180 if (i->pcursor->Valid()) {
181 CoinEntry entry(&i->keyTmp.second);
182 i->pcursor->GetKey(entry);
183 i->keyTmp.first = entry.key;
184 } else {
185 i->keyTmp.first = 0; // Make sure Valid() and GetKey() return false
186 }
187 return i;
188}
189
190bool CCoinsViewDBCursor::GetKey(COutPoint &key) const
191{

Callers 2

GetUTXOStatsFunction · 0.45
scantxoutsetFunction · 0.45

Calls 4

NewIteratorMethod · 0.45
SeekMethod · 0.45
ValidMethod · 0.45
GetKeyMethod · 0.45

Tested by

no test coverage detected