message: rpc/blockchain.cpp: thread safety annotations for latestblock
diff: @@ -53,7 +53,7 @@ struct CUpdatedBlock
  static Mutex cs_blockchange;
  static std::condition_variable cond_blockchange;
  -static CUpdatedBlock latestblock;
  +static CUpdatedBlock latestblock GUARDED_BY(cs_blockchange);
  NodeContext& EnsureNodeContext(const util::Ref& context)
  {
  @@ -236,7 +236,7 @@ static UniValue getbestblockhash(const JSONRPCRequest& request)
  void RPCNotifyBlockChange(const CBlockIndex* pindex)
  {
  if(pindex) {
  - std::lock_guard<std::mutex> lock(cs_blockchange);
  + LOCK(cs_blockchange);
  latestblock.hash = pindex->GetBlockHash();
  latestblock.height = pindex->nHeight;
  }
  @@ -271,9 +271,9 @@ static UniValue waitfornewblock(const JSONRPCRequest& request)
  WAIT_LOCK(cs_blockchange, lock);
  block = latestblock;
  if(timeout)
  - cond_blockchange.wait_for(lock, std::chrono::milliseconds(timeout), [&block]{return latestblock.height != block.height || latestblock.hash != block.hash || !IsRPCRunning(); });
  + cond_blockchange.wait_for(lock, std::chrono::milliseconds(timeout), [&block]() EXCLUSIVE_LOCKS_REQUIRED(cs_blockchange) {return latestblock.height != block.height || latestblock.hash != block.hash || !IsRPCRunning(); });
  else
  - cond_blockchange.wait(lock, [&block]{return latestblock.height != block.height || latestblock.hash != block.hash || !IsRPCRunning(); });
  + cond_blockchange.wait(lock, [&block]() EXCLUSIVE_LOCKS_REQUIRED(cs_blockchange) {return latestblock.height != block.height || latestblock.hash != block.hash || !IsRPCRunning(); });
  block = latestblock;
  }
  UniValue ret(UniValue::VOBJ);
  @@ -313,9 +313,9 @@ static UniValue waitforblock(const JSONRPCRequest& request)
  {
  WAIT_LOCK(cs_blockchange, lock);
  if(timeout)
  - cond_blockchange.wait_for(lock, std::chrono::milliseconds(timeout), [&hash]{return latestblock.hash == hash || !IsRPCRunning();});
  + cond_blockchange.wait_for(lock, std::chrono::milliseconds(timeout), [&hash]() EXCLUSIVE_LOCKS_REQUIRED(cs_blockchange) {return latestblock.hash == hash || !IsRPCRunning();});
  else
  - cond_blockchange.wait(lock, [&hash]{return latestblock.hash == hash || !IsRPCRunning(); });
  + cond_blockchange.wait(lock, [&hash]() EXCLUSIVE_LOCKS_REQUIRED(cs_blockchange) {return latestblock.hash == hash || !IsRPCRunning(); });
  block = latestblock;
  }
  @@ -357,9 +357,9 @@ static UniValue waitforblockheight(const JSONRPCRequest& request)
  {
  WAIT_LOCK(cs_blockchange, lock);
  if(timeout)
  - cond_blockchange.wait_for(lock, std::chrono::milliseconds(timeout), [&height]{return latestblock.height >= height || !IsRPCRunning();});
  + cond_blockchange.wait_for(lock, std::chrono::milliseconds(timeout), [&height]() EXCLUSIVE_LOCKS_REQUIRED(cs_blockchange) {return latestblock.height >= height || !IsRPCRunning();});
  else
  - cond_blockchange.wait(lock, [&height]{return latestblock.height >= height || !IsRPCRunning(); });
  + cond_blockchange.wait(lock, [&height]() EXCLUSIVE_LOCKS_REQUIRED(cs_blockchange) {return latestblock.height >= height || !IsRPCRunning(); });
  block = latestblock;
  }
  UniValue ret(UniValue::VOBJ);
  