Prevent autorewind if syncing. Not a critical update

This commit is contained in:
jl777
2018-04-15 23:25:26 +03:00
parent 7f0228a121
commit d9daa6281a

View File

@@ -53,7 +53,7 @@ using namespace std;
CCriticalSection cs_main; CCriticalSection cs_main;
extern uint8_t NOTARY_PUBKEY33[33]; extern uint8_t NOTARY_PUBKEY33[33];
extern int32_t KOMODO_LOADINGBLOCKS,KOMODO_LONGESTCHAIN; extern int32_t KOMODO_LOADINGBLOCKS,KOMODO_LONGESTCHAIN,KOMODO_NEWBLOCKS;
void komodo_block2pubkey33(uint8_t *pubkey33,CBlock *block); void komodo_block2pubkey33(uint8_t *pubkey33,CBlock *block);
BlockMap mapBlockIndex; BlockMap mapBlockIndex;
@@ -3529,11 +3529,13 @@ int32_t komodo_reverify_blockcheck(CValidationState& state,int32_t height,CBlock
if ( oneshot == 0 && IsInitialBlockDownload() == 0 && (tipindex= chainActive.Tip()) != 0 ) if ( oneshot == 0 && IsInitialBlockDownload() == 0 && (tipindex= chainActive.Tip()) != 0 )
{ {
// if 200 blocks behind longestchain and no blocks for 2 hours // 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 ) 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);
KOMODO_REWIND = tipindex->nHeight - 11;
/*
rewindtarget = tipindex->nHeight - 11; rewindtarget = tipindex->nHeight - 11;
fprintf(stderr,"rewindtarget <- %d\n",rewindtarget); fprintf(stderr,"rewindtarget <- %d\n",rewindtarget);
oneshot = 1; oneshot = 1;
@@ -3545,7 +3547,7 @@ int32_t komodo_reverify_blockcheck(CValidationState& state,int32_t height,CBlock
break; break;
} }
tipindex = chainActive.Tip(); 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);*/
} }
} }
} }