This commit is contained in:
jl777
2018-04-15 19:32:01 +03:00
parent a9855467e2
commit 2ca62c8784

View File

@@ -3085,17 +3085,16 @@ static bool ActivateBestChainStep(CValidationState &state, CBlockIndex *pindexMo
} }
if ( KOMODO_REWIND != 0 ) if ( KOMODO_REWIND != 0 )
{ {
CBlockIndex *tipindex;
fprintf(stderr,">>>>>>>>>>> rewind start ht.%d -> KOMODO_REWIND.%d\n",chainActive.Tip()->nHeight,KOMODO_REWIND); fprintf(stderr,">>>>>>>>>>> rewind start ht.%d -> KOMODO_REWIND.%d\n",chainActive.Tip()->nHeight,KOMODO_REWIND);
while ( KOMODO_REWIND > 0 && chainActive.Tip()->nHeight > KOMODO_REWIND ) while ( KOMODO_REWIND > 0 && (tipindex= chainActive.Tip()) != 0 && tipindex->nHeight > KOMODO_REWIND )
{ {
fBlocksDisconnected = true; fBlocksDisconnected = true;
fprintf(stderr,"%d ",(int32_t)chainActive.Tip()->nHeight); fprintf(stderr,"%d ",(int32_t)tipindex->nHeight);
InvalidateBlock(state,tipindex);
if ( !DisconnectTip(state) ) if ( !DisconnectTip(state) )
{
InvalidateBlock(state,chainActive.Tip());
break; break;
} }
}
fprintf(stderr,"reached rewind.%d, best to do: ./komodo-cli -ac_name=%s stop\n",KOMODO_REWIND,ASSETCHAINS_SYMBOL); fprintf(stderr,"reached rewind.%d, best to do: ./komodo-cli -ac_name=%s stop\n",KOMODO_REWIND,ASSETCHAINS_SYMBOL);
sleep(20); sleep(20);
fprintf(stderr,"resuming normal operations\n"); fprintf(stderr,"resuming normal operations\n");
@@ -3524,9 +3523,12 @@ int32_t komodo_check_deposit(int32_t height,const CBlock& block,uint32_t prevtim
int32_t komodo_reverify_blockcheck(CValidationState& state,int32_t height,CBlockIndex *pindex) int32_t komodo_reverify_blockcheck(CValidationState& state,int32_t height,CBlockIndex *pindex)
{ {
CBlockIndex *tipindex; int32_t rewindtarget; CBlockIndex *tipindex; int32_t rewindtarget;
if ( (tipindex= chainActive.Tip()) != 0 && height >= tipindex->nHeight && IsInitialBlockDownload() == 0 ) if ( IsInitialBlockDownload() == 0 && (tipindex= chainActive.Tip()) != 0 && height >= tipindex->nHeight-10 )
{ {
if ( KOMODO_LONGESTCHAIN > height+100 && GetAdjustedTime() > tipindex->nTime+3600 ) // if 200 blocks behind longestchain and no blocks for 2 hours
if ( KOMODO_LONGESTCHAIN > height+200 )
{
if ( GetAdjustedTime() > tipindex->nTime+3600*2 )
{ {
fprintf(stderr,"tip.%d longest.%d newblock.%d lag.%d blocktime.%u\n",tipindex->nHeight,KOMODO_LONGESTCHAIN,height,(int32_t)(GetAdjustedTime() - tipindex->nTime),tipindex->nTime); fprintf(stderr,"tip.%d longest.%d newblock.%d lag.%d blocktime.%u\n",tipindex->nHeight,KOMODO_LONGESTCHAIN,height,(int32_t)(GetAdjustedTime() - tipindex->nTime),tipindex->nTime);
rewindtarget = tipindex->nHeight - 11; rewindtarget = tipindex->nHeight - 11;
@@ -3542,6 +3544,7 @@ int32_t komodo_reverify_blockcheck(CValidationState& state,int32_t height,CBlock
fprintf(stderr,"rewind done to %d\n",tipindex!=0?tipindex->nHeight:-1); fprintf(stderr,"rewind done to %d\n",tipindex!=0?tipindex->nHeight:-1);
} }
} }
}
return(0); return(0);
} }
@@ -3769,11 +3772,10 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc
if (!ContextualCheckBlockHeader(block, state, pindexPrev)) if (!ContextualCheckBlockHeader(block, state, pindexPrev))
{ {
pindex->nStatus |= BLOCK_FAILED_MASK; pindex->nStatus |= BLOCK_FAILED_MASK;
fprintf(stderr,"known block.%d failing ContextualCheckBlockHeader\n",(int32_t)pindex->nHeight); //fprintf(stderr,"known block.%d failing ContextualCheckBlockHeader\n",(int32_t)pindex->nHeight);
return false; return false;
} }
} }
return true; return true;
} }