Merge pull request #3474

aec55a0 "getnetworkhashps" with defaults was yielding "0", the hashrate is not 0. (Gregory Maxwell)
This commit is contained in:
Wladimir J. van der Laan 2014-01-05 10:41:20 +01:00
commit 16403b4275
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
1 changed files with 4 additions and 1 deletions

View File

@ -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;