From 03e2210d24eec049b967a699527370d39d8e9355 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Apr 2018 23:22:22 +0300 Subject: [PATCH] Test --- src/main.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index fa66fdb12..8f3ea6108 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -54,6 +54,7 @@ using namespace std; CCriticalSection cs_main; extern uint8_t NOTARY_PUBKEY33[33]; extern int32_t KOMODO_LOADINGBLOCKS,KOMODO_LONGESTCHAIN; +int32_t KOMODO_NEWBLOCKS; void komodo_block2pubkey33(uint8_t *pubkey33,CBlock *block); BlockMap mapBlockIndex; @@ -2801,7 +2802,7 @@ void static UpdateTip(CBlockIndex *pindexNew) { // New best block nTimeBestReceived = GetTime(); mempool.AddTransactionsUpdated(1); - + KOMODO_NEWBLOCKS++; LogPrintf("%s: new best=%s height=%d log2_work=%.8g tx=%lu date=%s progress=%f cache=%.1fMiB(%utx)\n", __func__, chainActive.Tip()->GetBlockHash().ToString(), chainActive.Height(), log(chainActive.Tip()->nChainWork.getdouble())/log(2.0), (unsigned long)chainActive.Tip()->nChainTx, DateTimeStrFormat("%Y-%m-%d %H:%M:%S", chainActive.Tip()->GetBlockTime()), @@ -3529,11 +3530,13 @@ int32_t komodo_reverify_blockcheck(CValidationState& state,int32_t height,CBlock if ( oneshot == 0 && IsInitialBlockDownload() == 0 && (tipindex= chainActive.Tip()) != 0 ) { // if 200 blocks behind longestchain and no blocks for 2 hours - if ( KOMODO_LONGESTCHAIN > height+200 ) + if ( KOMODO_LONGESTCHAIN > height+200 && KOMODO_NEWBLOCKS == 0 ) { 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); + KOMODO_REWIND = tipindex->nHeight - 11; + /* rewindtarget = tipindex->nHeight - 11; fprintf(stderr,"rewindtarget <- %d\n",rewindtarget); oneshot = 1; @@ -3545,7 +3548,7 @@ int32_t komodo_reverify_blockcheck(CValidationState& state,int32_t height,CBlock break; } tipindex = chainActive.Tip(); - fprintf(stderr,"rewind done to %d\n",tipindex!=0?tipindex->nHeight:-1); + fprintf(stderr,"rewind done to %d\n",tipindex!=0?tipindex->nHeight:-1);*/ } } }