aboutsummaryrefslogtreecommitdiff
path: root/src/rpcblockchain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/rpcblockchain.cpp')
-rw-r--r--src/rpcblockchain.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp
index 11af1abf5d..b1b0c1ac16 100644
--- a/src/rpcblockchain.cpp
+++ b/src/rpcblockchain.cpp
@@ -65,8 +65,9 @@ Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex)
if (blockindex->pprev)
result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex()));
- if (blockindex->pnext)
- result.push_back(Pair("nextblockhash", blockindex->pnext->GetBlockHash().GetHex()));
+ CBlockIndex *pnext = blockindex->GetNextInMainChain();
+ if (pnext)
+ result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex()));
return result;
}