Merge pull request #1612 from luke-jr/opti_getblkhash
Optimize JSON-RPC getblockhash
This commit is contained in:
@@ -2047,10 +2047,7 @@ Value getblockhash(const Array& params, bool fHelp)
|
||||
if (nHeight < 0 || nHeight > nBestHeight)
|
||||
throw runtime_error("Block number out of range.");
|
||||
|
||||
CBlock block;
|
||||
CBlockIndex* pblockindex = mapBlockIndex[hashBestChain];
|
||||
while (pblockindex->nHeight > nHeight)
|
||||
pblockindex = pblockindex->pprev;
|
||||
CBlockIndex* pblockindex = FindBlockByHeight(nHeight);
|
||||
return pblockindex->phashBlock->GetHex();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user