diff options
| author | Jeff Garzik <[email protected]> | 2013-05-30 08:06:44 -0700 |
|---|---|---|
| committer | Jeff Garzik <[email protected]> | 2013-05-30 08:06:44 -0700 |
| commit | d3977156618ae9bb448aa76f579bf57f96c375ac (patch) | |
| tree | d72c05cf206d62f13b917572d896140961e28c61 /src/rpcblockchain.cpp | |
| parent | Merge pull request #2642 from sipa/rightgenesis (diff) | |
| parent | Make FindBlockByHeight constant-time. (diff) | |
| download | discoin-d3977156618ae9bb448aa76f579bf57f96c375ac.tar.xz discoin-d3977156618ae9bb448aa76f579bf57f96c375ac.zip | |
Merge pull request #2644 from sipa/constfindblock
Make FindBlockByHeight constant-time
Diffstat (limited to 'src/rpcblockchain.cpp')
| -rw-r--r-- | src/rpcblockchain.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 11af1abf5..b1b0c1ac1 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; } |