aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoinrpc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bitcoinrpc.cpp')
-rw-r--r--src/bitcoinrpc.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp
index 62b0b497ed..474207bdce 100644
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -2023,10 +2023,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();
}