Merge #7670: use cached block hash in blockToJSON()

a6ee0ca use cached block hash in blockToJSON() (Pavel Vasin)
This commit is contained in:
Wladimir J. van der Laan 2016-03-14 12:01:09 +01:00 committed by Alexander Block
parent fb4ec255c6
commit 5f9bfa0b6d

View File

@ -94,7 +94,7 @@ UniValue blockheaderToJSON(const CBlockIndex* blockindex)
UniValue blockToJSON(const CBlock& block, const CBlockIndex* blockindex, bool txDetails = false)
{
UniValue result(UniValue::VOBJ);
result.push_back(Pair("hash", block.GetHash().GetHex()));
result.push_back(Pair("hash", blockindex->GetBlockHash().GetHex()));
int confirmations = -1;
// Only report confirmations if the block is on the main chain
if (chainActive.Contains(blockindex))