aboutsummaryrefslogtreecommitdiff
path: root/src/bitcoinrpc.cpp
diff options
context:
space:
mode:
authorGregory Maxwell <[email protected]>2012-08-01 11:49:26 -0700
committerGregory Maxwell <[email protected]>2012-08-01 11:49:26 -0700
commit8ce7915aad505fd6e57f599b5b43fc241d8b4cb4 (patch)
tree37b12ebf89209456ecce18f18619408ac9b96edb /src/bitcoinrpc.cpp
parentMerge pull request #1632 from luke-jr/spelling (diff)
parentOptimize JSON-RPC getblockhash (diff)
downloaddiscoin-8ce7915aad505fd6e57f599b5b43fc241d8b4cb4.tar.xz
discoin-8ce7915aad505fd6e57f599b5b43fc241d8b4cb4.zip
Merge pull request #1612 from luke-jr/opti_getblkhash
Optimize JSON-RPC getblockhash
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 675c8462e..2e3f8a8e5 100644
--- a/src/bitcoinrpc.cpp
+++ b/src/bitcoinrpc.cpp
@@ -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();
}