From 2dd23a26175529a520961b544098458b2f2d5efe Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 21 Sep 2018 20:29:18 -1100 Subject: [PATCH] Test --- src/rpcblockchain.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index f66b1b204..f280cfc72 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -1410,16 +1410,18 @@ UniValue getchaintips(const UniValue& params, bool fHelp) + HelpExampleRpc("getchaintips", "") ); + if ( mapBlockIndex == 0 ) + throw runtime_error("mapBlockIndex is NULL\n"); LOCK(cs_main); /* Build up a list of chain tips. We start with the list of all known blocks, and successively remove blocks that appear as pprev of another block. */ + std::set setTips; BOOST_FOREACH(const PAIRTYPE(const uint256, CBlockIndex*)& item, mapBlockIndex) { - if ( item != 0 ) - setTips.insert(item.second); + setTips.insert(item.second); } BOOST_FOREACH(const PAIRTYPE(const uint256, CBlockIndex*)& item, mapBlockIndex) {