Test
This commit is contained in:
@@ -1378,8 +1378,6 @@ void komodo_passport_iteration()
|
|||||||
fprintf(stderr,"[%s] PASSPORT iteration waiting for KOMODO_INITDONE\n",ASSETCHAINS_SYMBOL);
|
fprintf(stderr,"[%s] PASSPORT iteration waiting for KOMODO_INITDONE\n",ASSETCHAINS_SYMBOL);
|
||||||
sleep(3);
|
sleep(3);
|
||||||
}
|
}
|
||||||
KOMODO_PASSPORT_INITDONE = 1;
|
|
||||||
return;
|
|
||||||
if ( komodo_chainactive_timestamp() > lastinterest )
|
if ( komodo_chainactive_timestamp() > lastinterest )
|
||||||
{
|
{
|
||||||
komodo_interestsum();
|
komodo_interestsum();
|
||||||
|
|||||||
@@ -1410,36 +1410,39 @@ UniValue getchaintips(const UniValue& params, bool fHelp)
|
|||||||
+ HelpExampleRpc("getchaintips", "")
|
+ HelpExampleRpc("getchaintips", "")
|
||||||
);
|
);
|
||||||
|
|
||||||
UniValue res(UniValue::VARR);
|
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<const CBlockIndex*, CompareBlocksByHeight> setTips;
|
||||||
|
int32_t n = 0;
|
||||||
|
BOOST_FOREACH(const PAIRTYPE(const uint256, CBlockIndex*)& item, mapBlockIndex)
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
n++;
|
||||||
|
setTips.insert(item.second);
|
||||||
/* Build up a list of chain tips. We start with the list of all
|
}
|
||||||
known blocks, and successively remove blocks that appear as pprev
|
fprintf(stderr,"iterations getchaintips %d\n",n);
|
||||||
of another block. */
|
n = 0;
|
||||||
|
BOOST_FOREACH(const PAIRTYPE(const uint256, CBlockIndex*)& item, mapBlockIndex)
|
||||||
std::set<const CBlockIndex*, CompareBlocksByHeight> setTips;
|
{
|
||||||
int32_t n = 0;
|
const CBlockIndex* pprev=0;
|
||||||
BOOST_FOREACH(const PAIRTYPE(const uint256, CBlockIndex*)& item, mapBlockIndex)
|
n++;
|
||||||
{
|
if ( item.second != 0 )
|
||||||
fprintf(stderr,"iterator %d\n",n++);
|
pprev = item.second->pprev;
|
||||||
setTips.insert(item.second);
|
if (pprev)
|
||||||
}
|
setTips.erase(pprev);
|
||||||
BOOST_FOREACH(const PAIRTYPE(const uint256, CBlockIndex*)& item, mapBlockIndex)
|
}
|
||||||
{
|
fprintf(stderr,"iterations getchaintips %d\n",n);
|
||||||
const CBlockIndex* pprev=0;
|
|
||||||
if ( item.second != 0 )
|
// Always report the currently active tip.
|
||||||
pprev = item.second->pprev;
|
setTips.insert(chainActive.LastTip());
|
||||||
if (pprev)
|
|
||||||
setTips.erase(pprev);
|
/* Construct the output array. */
|
||||||
}
|
UniValue res(UniValue::VARR); const CBlockIndex *forked;
|
||||||
// Always report the currently active tip.
|
BOOST_FOREACH(const CBlockIndex* block, setTips)
|
||||||
setTips.insert(chainActive.LastTip());
|
BOOST_FOREACH(const CBlockIndex* block, setTips)
|
||||||
|
|
||||||
/* Construct the output array. */
|
|
||||||
const CBlockIndex *forked;
|
|
||||||
BOOST_FOREACH(const CBlockIndex* block, setTips)
|
|
||||||
BOOST_FOREACH(const CBlockIndex* block, setTips)
|
|
||||||
{
|
{
|
||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
obj.push_back(Pair("height", block->nHeight));
|
obj.push_back(Pair("height", block->nHeight));
|
||||||
@@ -1449,7 +1452,7 @@ UniValue getchaintips(const UniValue& params, bool fHelp)
|
|||||||
{
|
{
|
||||||
const int branchLen = block->nHeight - forked->nHeight;
|
const int branchLen = block->nHeight - forked->nHeight;
|
||||||
obj.push_back(Pair("branchlen", branchLen));
|
obj.push_back(Pair("branchlen", branchLen));
|
||||||
|
|
||||||
string status;
|
string status;
|
||||||
if (chainActive.Contains(block)) {
|
if (chainActive.Contains(block)) {
|
||||||
// This block is part of the currently active chain.
|
// This block is part of the currently active chain.
|
||||||
@@ -1474,7 +1477,7 @@ UniValue getchaintips(const UniValue& params, bool fHelp)
|
|||||||
}
|
}
|
||||||
res.push_back(obj);
|
res.push_back(obj);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user