diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 365ae3584..64b71797f 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -367,8 +367,6 @@ UniValue gettxoutsetinfo(const UniValue& params, bool fHelp) + HelpExampleRpc("gettxoutsetinfo", "") ); - LOCK(cs_main); - UniValue ret(UniValue::VOBJ); CCoinsStats stats; diff --git a/src/txdb.cpp b/src/txdb.cpp index a7444dfa4..78edd645d 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -225,7 +225,10 @@ bool CCoinsViewDB::GetStats(CCoinsStats &stats) const { return error("%s: Deserialize or I/O error - %s", __func__, e.what()); } } - stats.nHeight = mapBlockIndex.find(GetBestBlock())->second->nHeight; + { + LOCK(cs_main); + stats.nHeight = mapBlockIndex.find(stats.hashBlock)->second->nHeight; + } stats.hashSerialized = ss.GetHash(); stats.nTotalAmount = nTotalAmount; return true;