aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-06-19 17:42:33 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-06-19 17:42:50 +0200
commit57539884f2097077c44f0abc13bc46629ab6249b (patch)
treea4c2c5dc466029e4d6770d9062b4e21b0b831857
parent7ecdcd99ca6c488378a82531f742ca3a6be5eaee (diff)
parent57092ed9e7edb3c60adc75823dd922ad67ddec62 (diff)
Merge pull request #6290
57092ed rpc: make `gettxoutsettinfo` run lock-free (Wladimir J. van der Laan)
-rw-r--r--src/rpcblockchain.cpp2
-rw-r--r--src/txdb.cpp5
2 files changed, 4 insertions, 3 deletions
diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp
index e45368cb97..85229e9857 100644
--- a/src/rpcblockchain.cpp
+++ b/src/rpcblockchain.cpp
@@ -345,8 +345,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 df9ff8d8c9..935b784676 100644
--- a/src/txdb.cpp
+++ b/src/txdb.cpp
@@ -147,7 +147,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;