This is pow altcoin based, which use sha-256 alogo to mine all the coins. We had to change first 1M coins with randomX alog and rest with original algo. Added nHeight parameter to
checkproofofwork() in pow.cpp, Now, problem is the occurrences of checkproofofwork in called files, here, difficult in getting current block height, for example validation.cppstatic bool CheckBlockHeader(const CBlockHeader& block, BlockValidationState& state, const Consensus::Params& consensusParams, bool fCheckPOW = true) { // Check proof of work matches claimed amount // Check proof of work matches claimed amount extern ChainstateManager& chainman; // This not correct ? getting error int nHeight = GetBlockHeight(block, chainman); // here need chainman if (fCheckPOW && !CheckProofOfWork(block.GetHash(), block.nBits, consensusParams, nHeight)) return state.Invalid(BlockValidationResult::BLOCK_INVALID_HEADER, "high-hash", "proof of work failed"); return true; } pow.cpp int GetBlockHeight(const CBlockHeader& block, ChainstateManager& chainman) { const CBlockIndex* pindex = chainman.ActiveChainstate().m_blockman.LookupBlockIndex(block.hashPrevBlock); if (!pindex) { throw std::runtime_error("Parent block index not found for hash: " + block.hashPrevBlock.ToString()); } return pindex->nHeight + 1; }
validation.cpp:4113:(.text+0x2cc1): undefined reference to `chainman’, What is the correct way tot get the block height?