MCPcopy Create free account
hub / github.com/ElementsProject/elements / Cursor

Method Cursor

src/txdb.cpp:245–262  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243};
244
245std::unique_ptr<CCoinsViewCursor> CCoinsViewDB::Cursor() const
246{
247 auto i = std::make_unique<CCoinsViewDBCursor>(
248 const_cast<CDBWrapper&>(*m_db).NewIterator(), GetBestBlock());
249 /* It seems that there are no "const iterators" for LevelDB. Since we
250 only need read operations on it, use a const-cast to get around
251 that restriction. */
252 i->pcursor->Seek(DB_COIN);
253 // Cache key of first record
254 if (i->pcursor->Valid()) {
255 CoinEntry entry(&i->keyTmp.second);
256 i->pcursor->GetKey(entry);
257 i->keyTmp.first = entry.key;
258 } else {
259 i->keyTmp.first = 0; // Make sure Valid() and GetKey() return false
260 }
261 return i;
262}
263
264bool CCoinsViewDBCursor::GetKey(COutPoint &key) const
265{

Callers 4

FUZZ_TARGET_INITFunction · 0.45
scantxoutsetFunction · 0.45
CreateUTXOSnapshotFunction · 0.45
GetUTXOStatsFunction · 0.45

Calls 4

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

Tested by 1

FUZZ_TARGET_INITFunction · 0.36