From cd01a5e18507c09eb6bbf159418e29c28fd3cadb Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Mon, 12 May 2014 12:24:22 +0200 Subject: [PATCH] Enable paranoid corruption checks in LevelDB >= 1.16 --- src/leveldbwrapper.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/leveldbwrapper.cpp b/src/leveldbwrapper.cpp index 5b4a9c147b..9e849696a8 100644 --- a/src/leveldbwrapper.cpp +++ b/src/leveldbwrapper.cpp @@ -32,6 +32,11 @@ static leveldb::Options GetOptions(size_t nCacheSize) { options.filter_policy = leveldb::NewBloomFilterPolicy(10); options.compression = leveldb::kNoCompression; options.max_open_files = 64; + if (leveldb::kMajorVersion > 1 || (leveldb::kMajorVersion == 1 && leveldb::kMinorVersion >= 16)) { + // LevelDB versions before 1.16 consider short writes to be corruption. Only trigger error + // on corruption in later versions. + options.paranoid_checks = true; + } return options; }