func (w *Worker) checkInPeriod(logger log.Logger, hash common.Hash,
	periodKey string, periodErr error) error {
	updateBlockNumber, err := w.getOfferingBlockNumber(logger, hash)
	if err != nil {
		return err
	}

	lastBlock, err := w.ethBack.LatestBlockNumber(context.Background())
	if err != nil {
		logger.Error(err.Error())
		return ErrInternal
	}

	removePeriod, err := data.ReadUintSetting(w.db.Querier, periodKey)
	if err != nil {
		return periodErr
	}

	if uint64(updateBlockNumber)+uint64(removePeriod) > lastBlock.Uint64() {
		return periodErr
	}

	return nil
}
func (w *Worker) checkInPeriod(logger log.Logger, hash common.Hash,
	periodKey string, periodErr error) error {
	updateBlockNumber, err := w.getOfferingBlockNumber(logger, hash)
	if err != nil {
		return err
	}

	lastBlock, err := w.ethBack.LatestBlockNumber(context.Background())
	if err != nil {
		logger.Error(err.Error())
		return ErrInternal
	}

	removePeriod, err := data.ReadUintSetting(w.db.Querier, periodKey)
	if err != nil {
		return periodErr
	}

	if uint64(updateBlockNumber)+uint64(removePeriod) > lastBlock.Uint64() {
		return periodErr
	}

	return nil
}
// checkInPeriod checks an offering being in period specified by periodKey.