diff --git a/src/komodo.h b/src/komodo.h index 029b25d38..04709571f 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -311,6 +311,12 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33) return(modval); } +int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp) +{ + memset(notarized_hashp,0,sizeof(*notarized_hashp)); + return(-1); +} + int32_t komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts) { static FILE *fp; static int32_t errs,didinit; char fname[512]; int32_t ht,k,func; uint8_t num,pubkeys[64][33]; diff --git a/src/main.cpp b/src/main.cpp index d2402ea76..3c86570bd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3069,16 +3069,21 @@ bool ContextualCheckBlockHeader(const CBlockHeader& block, CValidationState& sta CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(chainParams.Checkpoints()); if (pcheckpoint && nHeight < pcheckpoint->nHeight) return state.DoS(100, error("%s: forked chain older than last checkpoint (height %d) vs %d", __func__, nHeight,pcheckpoint->nHeight)); - /*else if ( nHeight < NOTARIZED_HEIGHT ) + else { - fprintf(stderr,"nHeight.%d < NOTARIZED_HEIGHT.%d\n",nHeight,NOTARIZED_HEIGHT); - return state.DoS(100, error("%s: forked chain older than last notarized (height %d) vs %d", __func__,nHeight, NOTARIZED_HEIGHT)); + int32_t notarized_height; uint256 notarized_hash; + notarized_height = komodo_notarizeddata(chainActive.Tip()->nHeight,¬arized_hash); + if ( nHeight < notarized_height ) + { + fprintf(stderr,"nHeight.%d < NOTARIZED_HEIGHT.%d\n",nHeight,notarized_height); + return state.DoS(100, error("%s: forked chain older than last notarized (height %d) vs %d", __func__,nHeight, notarized_height)); + } + else if ( nHeight == notarized_height && memcmp(&hash,¬arized_hash,sizeof(hash)) != 0 ) + { + fprintf(stderr,"nHeight.%d == NOTARIZED_HEIGHT.%d, diff hash\n",nHeight,notarized_height); + return state.DoS(100, error("%s: forked chain at notarized (height %d) with different hash", __func__, notarized_height)); + } } - else if ( nHeight == NOTARIZED_HEIGHT && memcmp(&hash,&NOTARIZED_HASH,sizeof(hash)) != 0 ) - { - fprintf(stderr,"nHeight.%d == NOTARIZED_HEIGHT.%d, diff hash\n",nHeight,NOTARIZED_HEIGHT); - return state.DoS(100, error("%s: forked chain at notarized (height %d) with different hash", __func__, NOTARIZED_HEIGHT)); - }*/ } // Reject block.nVersion < 4 blocks