aboutsummaryrefslogtreecommitdiff
path: root/src/rpc/blockchain.cpp
diff options
context:
space:
mode:
authorMarcoFalke <[email protected]>2019-05-02 14:34:09 -0400
committerMarcoFalke <[email protected]>2019-05-02 14:33:26 -0400
commitfaea56400d5578023133cf4d1c761cdeb0c3e3da (patch)
tree84f66d66aacf11aacae1b2eff4ba39563a1b61b8 /src/rpc/blockchain.cpp
parentrpc: Serialize in getblock without cs_main (diff)
downloaddiscoin-faea56400d5578023133cf4d1c761cdeb0c3e3da.tar.xz
discoin-faea56400d5578023133cf4d1c761cdeb0c3e3da.zip
rpc: Add lock annotations to block{,header}ToJSON
Diffstat (limited to 'src/rpc/blockchain.cpp')
-rw-r--r--src/rpc/blockchain.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp
index cd636a712..9d7d213f6 100644
--- a/src/rpc/blockchain.cpp
+++ b/src/rpc/blockchain.cpp
@@ -94,6 +94,8 @@ static int ComputeNextBlockAndDepth(const CBlockIndex* tip, const CBlockIndex* b
UniValue blockheaderToJSON(const CBlockIndex* tip, const CBlockIndex* blockindex)
{
// Serialize passed information without accessing chain state of the active chain!
+ AssertLockNotHeld(cs_main); // For performance reasons
+
UniValue result(UniValue::VOBJ);
result.pushKV("hash", blockindex->GetBlockHash().GetHex());
const CBlockIndex* pnext;
@@ -121,6 +123,8 @@ UniValue blockheaderToJSON(const CBlockIndex* tip, const CBlockIndex* blockindex
UniValue blockToJSON(const CBlock& block, const CBlockIndex* tip, const CBlockIndex* blockindex, bool txDetails)
{
// Serialize passed information without accessing chain state of the active chain!
+ AssertLockNotHeld(cs_main); // For performance reasons
+
UniValue result(UniValue::VOBJ);
result.pushKV("hash", blockindex->GetBlockHash().GetHex());
const CBlockIndex* pnext;