"getnetworkhashps" with defaults was yielding "0", the hashrate is not 0.

This was broken in 4c6d41b8b6.
This commit is contained in:
Gregory Maxwell 2013-12-29 03:14:06 -08:00
parent 6e7792003b
commit aec55a073d

View File

@ -55,7 +55,10 @@ void ShutdownRPCMining()
// or from the last difficulty change if 'lookup' is nonpositive. // 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. // If 'height' is nonnegative, compute the estimate at the time when a given block was found.
Value GetNetworkHashPS(int lookup, int height) { 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) if (pb == NULL || !pb->nHeight)
return 0; return 0;