From 11ed15a670c46c87bbd6eb3710b80b6be4388898 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 8 Apr 2018 21:34:49 +0300 Subject: [PATCH] Test --- src/komodo.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 95b4a8478..d0e1075be 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -577,11 +577,18 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr CBlockIndex *pindex; if ( IsInitialBlockDownload() == 0 && ((pindex= mapBlockIndex[srchash]) == 0 || pindex->nHeight != *notarizedheightp) ) { - fprintf(stderr,"FORK detected. notarized.%d %s not in this chain! REWIND to %d\n",*notarizedheightp,srchash.ToString().c_str(),sp->NOTARIZED_HEIGHT); + static int32_t last_rewind; int32_t rewindtarget; if ( sp->NOTARIZED_HEIGHT > 0 && sp->NOTARIZED_HEIGHT < *notarizedheightp ) - KOMODO_REWIND = sp->NOTARIZED_HEIGHT - 1; + rewindtarget = sp->NOTARIZED_HEIGHT - 1; else if ( *notarizedheightp > 101 ) - KOMODO_REWIND = *notarizedheightp - 101; + rewindtarget = *notarizedheightp - 101; + else rewindtarget = 0; + if ( rewindtarget != 0 && rewindtarget > KOMODO_REWIND && rewindtarget > last_rewind ) + { + last_rewind = rewindtarget; + KOMODO_REWIND = rewindtarget; + fprintf(stderr,"FORK detected. notarized.%d %s not in this chain! last notarization %d -> rewindtarget.%d\n",*notarizedheightp,srchash.ToString().c_str(),sp->NOTARIZED_HEIGHT,rewindtarget); + } } else validated = 1; if ( notarized != 0 && *notarizedheightp > sp->NOTARIZED_HEIGHT && *notarizedheightp < height && validated != 0 ) {