Skip to content

Commit 16403b4

Browse files
committed
Merge pull request #3474
aec55a0 "getnetworkhashps" with defaults was yielding "0", the hashrate is not 0. (Gregory Maxwell)
2 parents 51947e4 + aec55a0 commit 16403b4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/rpcmining.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ void ShutdownRPCMining()
5555
// or from the last difficulty change if 'lookup' is nonpositive.
5656
// If 'height' is nonnegative, compute the estimate at the time when a given block was found.
5757
Value GetNetworkHashPS(int lookup, int height) {
58-
CBlockIndex *pb = chainActive[height];
58+
CBlockIndex *pb = chainActive.Tip();
59+
60+
if (height >= 0 && height < chainActive.Height())
61+
pb = chainActive[height];
5962

6063
if (pb == NULL || !pb->nHeight)
6164
return 0;

0 commit comments

Comments
 (0)