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.
502void leveldb_readoptions_set_fill_cache(leveldb_readoptions_t* opt, uint8_t v) {503opt->rep.fill_cache = v;504}506void leveldb_readoptions_set_snapshot(leveldb_readoptions_t* opt,507const leveldb_snapshot_t* snap) {508opt->rep.snapshot = (snap ? snap->rep : nullptr);509}511leveldb_writeoptions_t* leveldb_writeoptions_create() {512return new leveldb_writeoptions_t;513}515void leveldb_writeoptions_destroy(leveldb_writeoptions_t* opt) { delete opt; }517void leveldb_writeoptions_set_sync(leveldb_writeoptions_t* opt, uint8_t v) {518opt->rep.sync = v;519}521leveldb_cache_t* leveldb_cache_create_lru(size_t capacity) {522leveldb_cache_t* c = new leveldb_cache_t;523c->rep = NewLRUCache(capacity);524return c;525}527void leveldb_cache_destroy(leveldb_cache_t* cache) {528delete cache->rep;529delete cache;530}532leveldb_env_t* leveldb_create_default_env() {533leveldb_env_t* result = new leveldb_env_t;534result->rep = Env::Default();535result->is_default = true;536return result;537}539void leveldb_env_destroy(leveldb_env_t* env) {540if (!env->is_default) delete env->rep;541delete env;542}544char* leveldb_env_get_test_directory(leveldb_env_t* env) {545std::string result;546if (!env->rep->GetTestDirectory(&result).ok()) {547return nullptr;548}550char* buffer = static_cast<char*>(malloc(result.size() + 1));551memcpy(buffer, result.data(), result.size());552buffer[result.size()] = '\0';553return buffer;554}556void leveldb_free(void* ptr) { free(ptr); }558int leveldb_major_version() { return kMajorVersion; }560int leveldb_minor_version() { return kMinorVersion; }562} // end extern "C"
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.