From 5215d24e8188258bee76e3b1d4b6af418bc806dc Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 16 Apr 2018 12:19:54 +0300 Subject: [PATCH] Test another chance --- src/main.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3e1063471..345a6d880 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3977,14 +3977,21 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc // Check for duplicate uint256 hash = block.GetHash(); BlockMap::iterator miSelf = mapBlockIndex.find(hash); - CBlockIndex *pindex = NULL; - if (miSelf != mapBlockIndex.end()) { + CBlockIndex *tipindex,*pindex = NULL; + if (miSelf != mapBlockIndex.end()) + { // Block header is already known. pindex = miSelf->second; if (ppindex) *ppindex = pindex; if ( pindex != 0 && pindex->nStatus & BLOCK_FAILED_MASK ) - return state.Invalid(error("%s: block is marked invalid", __func__), 0, "duplicate"); + { + if ( IsInitialBlockDownload() == 0 && (tipindex= chainActive.Tip()) != 0 &&KOMODO_LONGESTCHAIN > height+200 && KOMODO_NEWBLOCKS == 0 ) + { + pindex->nStatus &= ~(BLOCK_FAILED_MASK); + fprintf(stderr,"give ht.%d another chance\n",pindex->nHeight); + } else return state.Invalid(error("%s: block is marked invalid", __func__), 0, "duplicate"); + } #ifdef DEXcode if ( pindex != 0 && IsInitialBlockDownload() == 0 ) // jl777 debug test {