code: func (b *BlockChain) calcEasiestDifficulty(bits uint32, duration time.Duration) uint32 {
  	// Convert types used in the calculations below.
  	durationVal := int64(duration / time.Second)
  	adjustmentFactor := big.NewInt(b.chainParams.RetargetAdjustmentFactor)
  
  	// The test network rules allow minimum difficulty blocks after more
  	// than twice the desired amount of time needed to generate a block has
  	// elapsed.
  	if b.chainParams.ReduceMinDifficulty {
  		reductionTime := int64(b.chainParams.MinDiffReductionTime /
  			time.Second)
  		if durationVal > reductionTime {
  			return b.chainParams.PowLimitBits
  		}
  	}
  
  	// Since easier difficulty equates to higher numbers, the easiest
  	// difficulty for a given duration is the largest value possible given
  	// the number of retargets for the duration and starting difficulty
  	// multiplied by the max adjustment factor.
  	newTarget := CompactToBig(bits)
  	for durationVal > 0 && newTarget.Cmp(b.chainParams.PowLimit) < 0 {
  		newTarget.Mul(newTarget, adjustmentFactor)
  		durationVal -= b.maxRetargetTimespan
  	}
  
  	// Limit new value to the proof of work limit.
  	if newTarget.Cmp(b.chainParams.PowLimit) > 0 {
  		newTarget.Set(b.chainParams.PowLimit)
  	}
  
  	return BigToCompact(newTarget)
  }
docs: // calcEasiestDifficulty calculates the easiest possible difficulty that a block
  // can have given starting difficulty bits and a duration.  It is mainly used to
  // verify that claimed proof of work by a block is sane as compared to a
  // known good checkpoint.