From 2c8d6b22461fda9b4de1f7f1f05a968a713e5c9e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 15 Apr 2018 20:06:30 +0300 Subject: [PATCH] One shot rewind --- src/main.cpp | 4 +++- src/version.h | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 4c4038516..c7f500fa1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3522,8 +3522,9 @@ 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) { + static int32_t oneshot; CBlockIndex *tipindex; int32_t rewindtarget; - if ( 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 ( KOMODO_LONGESTCHAIN > height+200 ) @@ -3533,6 +3534,7 @@ int32_t komodo_reverify_blockcheck(CValidationState& state,int32_t height,CBlock 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; fprintf(stderr,"rewindtarget <- %d\n",rewindtarget); + oneshot = 1; while ( rewindtarget > 0 && (tipindex= chainActive.Tip()) != 0 && tipindex->nHeight > rewindtarget ) { fprintf(stderr,"%d ",(int32_t)tipindex->nHeight); diff --git a/src/version.h b/src/version.h index 25527895d..0a12fe8cb 100644 --- a/src/version.h +++ b/src/version.h @@ -31,3 +31,5 @@ static const int BIP0031_VERSION = 60000; static const int MEMPOOL_GD_VERSION = 60002; #endif // BITCOIN_VERSION_H + +