diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index de77c6fb3..2a226a714 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -658,6 +658,13 @@ int32_t komodo_blockload(CBlock& block,CBlockIndex *pindex) return(0); } +uint32_t komodo_chainactive_timestamp() +{ + if ( chainActive.Tip() != 0 ) + return((uint32_t)chainActive.Tip()->GetBlockTime()); + else return(0); +} + CBlockIndex *komodo_chainactive(int32_t height) { if ( chainActive.Tip() != 0 ) diff --git a/src/pow.cpp b/src/pow.cpp index 033f8d9e3..9621fadad 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -13,13 +13,13 @@ #include "streams.h" #include "uint256.h" #include "util.h" -#include "consensus/validation.h" #include "sodium.h" #ifdef ENABLE_RUST #include "librustzcash.h" #endif // ENABLE_RUST +uint32_t komodo_chainactive_timestamp(); unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHeader *pblock, const Consensus::Params& params) { @@ -136,8 +136,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in extern int32_t KOMODO_REWIND; bool fNegative,fOverflow; int32_t i,nonzpkeys=0,nonz=0,special=0,special2=0,notaryid=-1,duplicate,flag = 0, mids[66]; uint32_t timestamp = 0; arith_uint256 bnTarget; CBlockIndex *pindex; uint8_t pubkeys[66][33]; - if ( (pindex= chainActive.Tip()) != 0 ) - timestamp = (uint32_t)pindex->GetBlockTime(); + timestamp = komodo_chainactive_timestamp(); bnTarget.SetCompact(nBits, &fNegative, &fOverflow); if ( height == 0 ) height = komodo_currentheight() + 1;