diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-01-05 10:41:20 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-01-05 10:43:10 +0100 |
commit | 16403b42759205461918c652fdc5b71c422c44a2 (patch) | |
tree | d6637cf5549a06256516fd9c2267d8c6362590a5 /src | |
parent | 51947e49720e821e8b619f8e402fb2644e598d59 (diff) | |
parent | aec55a073def2e6d5d11ae0e8ca5efb48c9cb0fe (diff) |
Merge pull request #3474
aec55a0 "getnetworkhashps" with defaults was yielding "0", the hashrate is not 0. (Gregory Maxwell)
Diffstat (limited to 'src')
-rw-r--r-- | src/rpcmining.cpp | 5 |
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; |