From b697a724b9586eef8ef1df880ac7c28042f9a4a0 Mon Sep 17 00:00:00 2001 From: selsta Date: Fri, 28 Aug 2026 23:09:44 +0200 Subject: [PATCH] lmdb: retain percentage fallback for batch resizing --- src/blockchain_db/lmdb/db_lmdb.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp index 11edff7ed..c00d9e98e 100644 --- a/src/blockchain_db/lmdb/db_lmdb.cpp +++ b/src/blockchain_db/lmdb/db_lmdb.cpp @@ -617,18 +617,13 @@ bool BlockchainLMDB::need_resize(uint64_t threshold_size) const float resize_percent = RESIZE_PERCENT; MDEBUG(boost::format("Percent used: %.04f Percent threshold: %.04f") % (100.*size_used/mei.me_mapsize) % (100.*resize_percent)); - if (threshold_size > 0) + if (threshold_size > 0 && mei.me_mapsize - size_used <= threshold_size) { - if (mei.me_mapsize - size_used < threshold_size) - { - MINFO("Threshold met (size-based)"); - return true; - } - else - return false; + MINFO("Threshold met (size-based)"); + return true; } - if ((double)size_used / mei.me_mapsize > resize_percent) + if ((double)size_used / mei.me_mapsize >= resize_percent) { MINFO("Threshold met (percent-based)"); return true;