Eliminate mapBlockIndex risk of nulls across VRSC

This commit is contained in:
miketout
2018-10-14 11:59:13 -07:00
parent aeadfa0490
commit d565e7b73c
6 changed files with 31 additions and 23 deletions

View File

@@ -660,8 +660,8 @@ UniValue verifytxoutproof(const UniValue& params, bool fHelp)
return res;
LOCK(cs_main);
if (!mapBlockIndex.count(merkleBlock.header.GetHash()) || !chainActive.Contains(mapBlockIndex[merkleBlock.header.GetHash()]))
uint256 idx = merkleBlock.header.GetHash();
if (!mapBlockIndex.count(merkleBlock.header.GetHash()) || (mapBlockIndex.count(idx) && !chainActive.Contains(mapBlockIndex[idx])))
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found in chain");
BOOST_FOREACH(const uint256& hash, vMatch)