diff --git a/src/komodo.h b/src/komodo.h index 3ab36075d..7119f9b88 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -362,6 +362,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) printf("hwmheight.%d vs pindex->nHeight.%d reorg.%d\n",hwmheight,pindex->nHeight,hwmheight-pindex->nHeight); // reset komodostate } + CURRENT_HEIGHT = pindex->nHeight; if ( komodo_is_issuer() != 0 ) { while ( KOMODO_REALTIME == 0 || time(NULL) <= KOMODO_REALTIME ) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index ef503c0e0..d883e16ce 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -15,7 +15,7 @@ int COINBASE_MATURITY = 100; -int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE; +int32_t IS_KOMODO_NOTARY,USE_EXTERNAL_PUBKEY,KOMODO_CHOSEN_ONE,CURRENT_HEIGHT; std::string NOTARY_PUBKEY; uint8_t NOTARY_PUBKEY33[33]; diff --git a/src/pow.cpp b/src/pow.cpp index 43c68b322..e08706d5c 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -105,7 +105,7 @@ bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& param } int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33); -extern int32_t KOMODO_CHOSEN_ONE; +extern int32_t KOMODO_CHOSEN_ONE,CURRENT_HEIGHT; bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned int nBits, const Consensus::Params& params) { @@ -114,7 +114,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in bnTarget.SetCompact(nBits, &fNegative, &fOverflow); if ( height == 0 ) - height = chainActive.Tip()->nHeight + 1; + height = CURRENT_HEIGHT + 1; if ( height > 34000 ) // 0 -> non-special notary { special = komodo_chosennotary(¬aryid,height,pubkey33);