Skip to content

Commit 5753988

Browse files
committed
Merge pull request #6290
57092ed rpc: make `gettxoutsettinfo` run lock-free (Wladimir J. van der Laan)
2 parents 7ecdcd9 + 57092ed commit 5753988

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/rpcblockchain.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,6 @@ UniValue gettxoutsetinfo(const UniValue& params, bool fHelp)
345345
+ HelpExampleRpc("gettxoutsetinfo", "")
346346
);
347347

348-
LOCK(cs_main);
349-
350348
UniValue ret(UniValue::VOBJ);
351349

352350
CCoinsStats stats;

src/txdb.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@ bool CCoinsViewDB::GetStats(CCoinsStats &stats) const {
147147
return error("%s: Deserialize or I/O error - %s", __func__, e.what());
148148
}
149149
}
150-
stats.nHeight = mapBlockIndex.find(GetBestBlock())->second->nHeight;
150+
{
151+
LOCK(cs_main);
152+
stats.nHeight = mapBlockIndex.find(stats.hashBlock)->second->nHeight;
153+
}
151154
stats.hashSerialized = ss.GetHash();
152155
stats.nTotalAmount = nTotalAmount;
153156
return true;

0 commit comments

Comments
 (0)