-6.9 C
New York
Wednesday, January 22, 2025

altcoin growth – Is there right solution to get the block top?


That is pow altcoin primarily based, which use sha-256 alogo to mine all of the cash. We needed to change first 1M cash with randomX alog and relaxation with unique algo. Added nHeight parameter to
checkproofofwork() in pow.cpp, Now, downside is the occurrences of checkproofofwork in known as recordsdata, right here, troublesome in getting present block top, for instance validation.cpp
static bool CheckBlockHeader(const CBlockHeader& block, BlockValidationState& state, const Consensus::Params& consensusParams, bool fCheckPOW = true) { // Verify proof of labor matches claimed quantity // Verify proof of labor matches claimed quantity extern ChainstateManager& chainman; // This not right ? getting error int nHeight = GetBlockHeight(block, chainman); // right here want chainman if (fCheckPOW && !CheckProofOfWork(block.GetHash(), block.nBits, consensusParams, nHeight)) return state.Invalid(BlockValidationResult::BLOCK_INVALID_HEADER, "high-hash", "proof of labor 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("Mother or father block index not discovered for hash: " + block.hashPrevBlock.ToString()); } return pindex->nHeight + 1; } validation.cpp:4113:(.textual content+0x2cc1): undefined reference to `chainman’, What’s the right method tot get the block top?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles