aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-01-05 10:41:20 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2014-01-05 10:43:10 +0100
commit16403b42759205461918c652fdc5b71c422c44a2 (patch)
treed6637cf5549a06256516fd9c2267d8c6362590a5
parent51947e49720e821e8b619f8e402fb2644e598d59 (diff)
parentaec55a073def2e6d5d11ae0e8ca5efb48c9cb0fe (diff)
Merge pull request #3474
aec55a0 "getnetworkhashps" with defaults was yielding "0", the hashrate is not 0. (Gregory Maxwell)
-rw-r--r--src/rpcmining.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/rpcmining.cpp b/src/rpcmining.cpp
index 1a8462fdea..564f0401f1 100644
--- a/src/rpcmining.cpp
+++ b/src/rpcmining.cpp
@@ -55,7 +55,10 @@ void ShutdownRPCMining()
// or from the last difficulty change if 'lookup' is nonpositive.
// If 'height' is nonnegative, compute the estimate at the time when a given block was found.
Value GetNetworkHashPS(int lookup, int height) {
- CBlockIndex *pb = chainActive[height];
+ CBlockIndex *pb = chainActive.Tip();
+
+ if (height >= 0 && height < chainActive.Height())
+ pb = chainActive[height];
if (pb == NULL || !pb->nHeight)
return 0;