diff --git a/src/kernel.cpp b/src/kernel.cpp index 26d9503ea609e..d04d0d0ed795c 100644 --- a/src/kernel.cpp +++ b/src/kernel.cpp @@ -87,19 +87,8 @@ bool CStakeKernel::CheckKernelHash(bool fSkipLog) const */ // helper function for CheckProofOfStake and GetStakeKernelHash -bool LoadStakeInput(const CBlock& block, const CBlockIndex* pindexPrev, std::unique_ptr& stake) +static bool LoadStakeInput(const CBlock& block, std::unique_ptr& stake) { - // If previous index is not provided, look for it in the blockmap - if (!pindexPrev) { - BlockMap::iterator mi = mapBlockIndex.find(block.hashPrevBlock); - if (mi != mapBlockIndex.end() && (*mi).second) pindexPrev = (*mi).second; - else return error("%s : couldn't find previous block", __func__); - } else { - // check that is the actual parent block - if (block.hashPrevBlock != pindexPrev->GetBlockHash()) - return error("%s : previous block mismatch", __func__); - } - // Check that this is a PoS block if (!block.IsProofOfStake()) return error("called on non PoS block"); @@ -153,7 +142,7 @@ bool CheckProofOfStake(const CBlock& block, std::string& strError, const CBlockI const int nHeight = pindexPrev->nHeight + 1; // Initialize stake input std::unique_ptr stakeInput; - if (!LoadStakeInput(block, pindexPrev, stakeInput)) { + if (!LoadStakeInput(block, stakeInput)) { strError = "stake input initialization failed"; return false; } @@ -207,7 +196,7 @@ bool GetStakeKernelHash(uint256& hashRet, const CBlock& block, const CBlockIndex { // Initialize stake input std::unique_ptr stakeInput; - if (!LoadStakeInput(block, pindexPrev, stakeInput)) + if (!LoadStakeInput(block, stakeInput)) return error("%s : stake input initialization failed", __func__); CStakeKernel stakeKernel(pindexPrev, stakeInput.get(), block.nBits, block.nTime);