Restore per-algo block lookup helper
This commit is contained in:
parent
2210ac3451
commit
a745563d28
2 changed files with 18 additions and 0 deletions
17
src/pow.cpp
17
src/pow.cpp
|
|
@ -196,6 +196,23 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
|||
return bnNew.GetCompact();
|
||||
}
|
||||
|
||||
const CBlockIndex* GetLastBlockIndexForAlgoFast(const CBlockIndex* pindex, int algo)
|
||||
{
|
||||
if (algo < 0 || algo >= NUM_ALGOS_IMPL) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
while (pindex) {
|
||||
if (pindex->GetAlgo() == algo) {
|
||||
return pindex;
|
||||
}
|
||||
|
||||
pindex = pindex->lastAlgoBlocks[algo];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params& params)
|
||||
{
|
||||
bool fNegative;
|
||||
|
|
|
|||
|
|
@ -20,5 +20,6 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
|
|||
|
||||
/** Check whether a block hash satisfies the proof-of-work requirement specified by nBits */
|
||||
bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params&);
|
||||
const CBlockIndex* GetLastBlockIndexForAlgoFast(const CBlockIndex* pindex, int algo);
|
||||
|
||||
#endif // DIGIBYTE_POW_H
|
||||
|
|
|
|||
Loading…
Reference in a new issue