+/- prints

This commit is contained in:
jl777
2019-01-23 22:22:52 -11:00
parent effb3a2a10
commit 1a9476e844
2 changed files with 7 additions and 4 deletions

View File

@@ -708,7 +708,9 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr
if ( ASSETCHAINS_SYMBOL[0] != 0 ) if ( ASSETCHAINS_SYMBOL[0] != 0 )
printf("[%s] ht.%d NOTARIZED.%d %s.%s %sTXID.%s lens.(%d %d) MoM.%s %d\n",ASSETCHAINS_SYMBOL,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),ASSETCHAINS_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),opretlen,len,sp->MoM.ToString().c_str(),sp->MoMdepth); printf("[%s] ht.%d NOTARIZED.%d %s.%s %sTXID.%s lens.(%d %d) MoM.%s %d\n",ASSETCHAINS_SYMBOL,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,srchash.ToString().c_str(),ASSETCHAINS_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),opretlen,len,sp->MoM.ToString().c_str(),sp->MoMdepth);
if (RemoveOrphanedBlocks(*notarizedheightp)) if (RemoveOrphanedBlocks(*notarizedheightp))
fprintf(stderr, "Sucessfully removed all known orphaned blocks before height %d\n",*notarizedheightp); {
//fprintf(stderr, "Sucessfully removed all known orphaned blocks before height %d\n",*notarizedheightp);
}
if ( ASSETCHAINS_SYMBOL[0] == 0 ) if ( ASSETCHAINS_SYMBOL[0] == 0 )
{ {
if ( signedfp == 0 ) if ( signedfp == 0 )

View File

@@ -1998,12 +1998,11 @@ bool RemoveOrphanedBlocks(int32_t notarized_height)
LOCK(cs_main); LOCK(cs_main);
std::vector<const CBlockIndex*> prunedblocks; std::vector<const CBlockIndex*> prunedblocks;
std::set<const CBlockIndex*, CompareBlocksByHeightMain> setTips; std::set<const CBlockIndex*, CompareBlocksByHeightMain> setTips;
int32_t n = 0; int32_t m=0,n = 0;
// get notarised timestamp and use this as a backup incase the forked block has no height. // get notarised timestamp and use this as a backup incase the forked block has no height.
// we -600 to make sure the time is within future block constraints. // we -600 to make sure the time is within future block constraints.
uint32_t notarized_timestamp = komodo_heightstamp(notarized_height)-600; uint32_t notarized_timestamp = komodo_heightstamp(notarized_height)-600;
fprintf(stderr, "removing oprhans from before %d\n", notarized_height); // Most of this code is a direct copy from GetChainTips RPC. Which gives a return of all
// Most of this code is a direct copy from GetChainTips RPC. Which gives a return of all
// blocks that are not in the main chain. // blocks that are not in the main chain.
BOOST_FOREACH(const PAIRTYPE(const uint256, CBlockIndex*)& item, mapBlockIndex) BOOST_FOREACH(const PAIRTYPE(const uint256, CBlockIndex*)& item, mapBlockIndex)
{ {
@@ -2038,8 +2037,10 @@ bool RemoveOrphanedBlocks(int32_t notarized_height)
// We need to try and clear the block index from mapBlockIndex now, otherwise node will need a restart. // We need to try and clear the block index from mapBlockIndex now, otherwise node will need a restart.
BOOST_FOREACH(const CBlockIndex* block, prunedblocks) BOOST_FOREACH(const CBlockIndex* block, prunedblocks)
{ {
m++;
mapBlockIndex.erase(block->GetBlockHash()); mapBlockIndex.erase(block->GetBlockHash());
} }
fprintf(stderr, "%s removed %d of %d orphans from before %d\n",ASSETCHAINS_SYMBOL,m,n, notarized_height);
return true; return true;
} }
return false; return false;