code: func (b *blockManager) checkHeaderSanity(blockHeader *wire.BlockHeader,
  	maxTimestamp time.Time, reorgAttempt bool) error {
  	diff, err := b.calcNextRequiredDifficulty(
  		blockHeader.Timestamp, reorgAttempt)
  	if err != nil {
  		return err
  	}
  	stubBlock := btcutil.NewBlock(&wire.MsgBlock{
  		Header: *blockHeader,
  	})
  	err = blockchain.CheckProofOfWork(stubBlock,
  		blockchain.CompactToBig(diff))
  	if err != nil {
  		return err
  	}
  	// Ensure the block time is not too far in the future.
  	if blockHeader.Timestamp.After(maxTimestamp) {
  		return fmt.Errorf("block timestamp of %v is too far in the "+
  			"future", blockHeader.Timestamp)
  	}
  	return nil
  }
docs: // checkHeaderSanity checks the PoW, and timestamp of a block header.