Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
251saved_key_.clear();252ClearSavedValue();253} else {254Slice raw_value = iter_->value();255if (saved_value_.capacity() > raw_value.size() + 1048576) {256std::string empty;257swap(empty, saved_value_);258}259SaveKey(ExtractUserKey(iter_->key()), &saved_key_);260saved_value_.assign(raw_value.data(), raw_value.size());261}262}263iter_->Prev();264} while (iter_->Valid());265}267if (value_type == kTypeDeletion) {268// End269valid_ = false;270saved_key_.clear();271ClearSavedValue();272direction_ = kForward;273} else {274valid_ = true;275}276}278void DBIter::Seek(const Slice& target) {279direction_ = kForward;280ClearSavedValue();281saved_key_.clear();282AppendInternalKey(&saved_key_,283ParsedInternalKey(target, sequence_, kValueTypeForSeek));284iter_->Seek(saved_key_);285if (iter_->Valid()) {286FindNextUserEntry(false, &saved_key_ /* temporary storage */);287} else {288valid_ = false;289}290}292void DBIter::SeekToFirst() {293direction_ = kForward;294ClearSavedValue();295iter_->SeekToFirst();296if (iter_->Valid()) {297FindNextUserEntry(false, &saved_key_ /* temporary storage */);298} else {299valid_ = false;300}301}303void DBIter::SeekToLast() {304direction_ = kReverse;305ClearSavedValue();306iter_->SeekToLast();307FindPrevUserEntry();308}310} // anonymous namespace312Iterator* NewDBIterator(DBImpl* db, const Comparator* user_key_comparator,313Iterator* internal_iter, SequenceNumber sequence,314uint32_t seed) {315return new DBIter(db, user_key_comparator, internal_iter, sequence, seed);316}318} // namespace leveldb
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.