Explicitly check the min-difficulty flag against boost::none

It isn't clear how a boost::optional that holds 0 (which is the case for
regtest) is coerced to a boolean, unless you pore over the Boost
documentation. An explicit check is clearer.
This commit is contained in:
Jack Grigg
2018-10-04 23:29:11 +01:00
parent 1f7ee4af70
commit 4c90270469
2 changed files with 3 additions and 3 deletions

View File

@@ -27,7 +27,7 @@ unsigned int GetNextWorkRequired(const CBlockIndex* pindexLast, const CBlockHead
{
// Comparing to pindexLast->nHeight with >= because this function
// returns the work required for the block after pindexLast.
if (params.nPowAllowMinDifficultyBlocksAfterHeight &&
if (params.nPowAllowMinDifficultyBlocksAfterHeight != boost::none &&
pindexLast->nHeight >= params.nPowAllowMinDifficultyBlocksAfterHeight.get())
{
// Special difficulty rule for testnet: