From e5a5260bda4d873f1efb54de95517d7492a79a64 Mon Sep 17 00:00:00 2001 From: Brannon King Date: Fri, 6 Mar 2020 10:25:05 -0700 Subject: [PATCH] fix EstimateSize for gettxoutsetinfo --- src/txdb.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/txdb.cpp b/src/txdb.cpp index 3ceff33cf..379a1b43c 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -157,8 +157,8 @@ bool CCoinsViewDB::BatchWrite(const CCoinsMap &mapCoins, const uint256 &hashBloc size_t CCoinsViewDB::EstimateSize() const { size_t ret = 0; - db << "SELECT COUNT(*) FROM unspent" >> ret; - return ret * 100; + db << "SELECT COUNT(*) FROM unspent ORDER BY txID, txN" >> ret; // force index use via order by + return ret * 770; // number chosen empirically } CBlockTreeDB::CBlockTreeDB(size_t nCacheSize, bool fMemory, bool fWipe)