Prevent autorewind if syncing. Not a critical update
This commit is contained in:
30
src/main.cpp
30
src/main.cpp
@@ -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,23 +3529,25 @@ 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);
|
||||||
rewindtarget = tipindex->nHeight - 11;
|
KOMODO_REWIND = tipindex->nHeight - 11;
|
||||||
fprintf(stderr,"rewindtarget <- %d\n",rewindtarget);
|
/*
|
||||||
oneshot = 1;
|
rewindtarget = tipindex->nHeight - 11;
|
||||||
while ( rewindtarget > 0 && (tipindex= chainActive.Tip()) != 0 && tipindex->nHeight > rewindtarget )
|
fprintf(stderr,"rewindtarget <- %d\n",rewindtarget);
|
||||||
{
|
oneshot = 1;
|
||||||
fprintf(stderr,"%d ",(int32_t)tipindex->nHeight);
|
while ( rewindtarget > 0 && (tipindex= chainActive.Tip()) != 0 && tipindex->nHeight > rewindtarget )
|
||||||
InvalidateBlock(state,tipindex);
|
{
|
||||||
if ( !DisconnectTip(state) )
|
fprintf(stderr,"%d ",(int32_t)tipindex->nHeight);
|
||||||
break;
|
InvalidateBlock(state,tipindex);
|
||||||
}
|
if ( !DisconnectTip(state) )
|
||||||
tipindex = chainActive.Tip();
|
break;
|
||||||
fprintf(stderr,"rewind done to %d\n",tipindex!=0?tipindex->nHeight:-1);
|
}
|
||||||
|
tipindex = chainActive.Tip();
|
||||||
|
fprintf(stderr,"rewind done to %d\n",tipindex!=0?tipindex->nHeight:-1);*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user