<p>There are two reasons for having the fork in the first place:</p>

<ul>
<li><p>Upstream LevelDB does not support Windows, and the branches that are available elsewhere don't support MinGW (which Bitcoin Core uses for its Windows release builds).</p></li>
<li><p>After the scare the project experienced with the BDB locks bug, which resulted in a fork between different versions (see BIP50), the developers prefer to have exact pinned versions of all libraries that may affect consensus rules. This means for example if a bug were found in LevelDB that affects every implementation equally, Bitcoin Core may be forced to not fix it, in order to not cause a diversion (depending on the nature of the bug).</p></li>
</ul>

<p>Additionally, it permitted making some build system integrations easier, and disabling compression in the code (which does not help for Bitcoin Core's use case).</p>

CC BY-SA 4.0
2018-05-14T16:00:58.707Z
2018-05-14T16:00:58.707Z
Pieter Wuille
<p>Sometimes LevelDB has bugs and those bugs sometimes are not fixed in a timely manner in the upstream LevelDB project. These bugs can be problematic for Bitcoin Core so a fork of LevelDB was created to handle these bugs specifically.</p>

<p>Additionally, to ensure security, we want to use a specific version of LevelDB at a specific commit. By having our own fork of it, we can control what version and what commit it is on so that we can control exactly what code we are putting into Bitcoin Core.</p>

CC BY-SA 4.0
2018-05-14T15:33:50.157Z
2018-05-14T15:33:50.157Z
Ava Chow
<p>Why did Bitcoin Core fork LevelDB? What special needs does Bitcoin Core have, which require a specialized version of LevelDB?</p>

<bitcoin-core><bitcoin-core-development><database><leveldb>
Why was Bitcoin Core in need of a fork of LevelDB?
MCCCS
# Why was Bitcoin Core in need of a fork of LevelDB?

(Asked by: username_0 on 2018-05-14)

Why did Bitcoin Core fork LevelDB? What special needs does Bitcoin Core have, which require a specialized version of LevelDB?

**Tags:** bitcoin-core, bitcoin-core-development, database, leveldb


---

## 2 answers

### Answer by username_1 on 2018-05-14. Score: 3 | Accepted answer

There are two reasons for having the fork in the first place:

* Upstream LevelDB does not support Windows, and the branches that are available elsewhere don't support MinGW (which Bitcoin Core uses for its Windows release builds).
* After the scare the project experienced with the BDB locks bug, which resulted in a fork between different versions (see BIP50), the developers prefer to have exact pinned versions of all libraries that may affect consensus rules. This means for example if a bug were found in LevelDB that affects every implementation equally, Bitcoin Core may be forced to not fix it, in order to not cause a diversion (depending on the nature of the bug).

Additionally, it permitted making some build system integrations easier, and disabling compression in the code (which does not help for Bitcoin Core's use case).


---

### Answer by username_2 on 2018-05-14. Score: 4

Sometimes LevelDB has bugs and those bugs sometimes are not fixed in a timely manner in the upstream LevelDB project. These bugs can be problematic for Bitcoin Core so a fork of LevelDB was created to handle these bugs specifically.

Additionally, to ensure security, we want to use a specific version of LevelDB at a specific commit. By having our own fork of it, we can control what version and what commit it is on so that we can control exactly what code we are putting into Bitcoin Core.


---

