proc/worker/client.go
func (w *Worker) ClientPreChannelTopUp(job *data.Job) error {
	logger := w.logger.Add("method", "ClientPreChannelTopUp", "job", job)

	ch, err := w.relatedChannel(logger, job, data.JobClientPreChannelTopUp)
	if err != nil {
		return err
	}

	offer, err := w.offering(logger, ch.Offering)
	if err != nil {
		return err
	}

	acc, err := w.account(logger, ch.Client)
	if err != nil {
		return err
	}

	logger = logger.Add("channel", ch, "offering", offer)

	var jdata data.JobTopUpChannelData
	if err := w.unmarshalDataTo(logger, job.Data, &jdata); err != nil {
		return err
	}

	if err := w.checkDeposit(logger, acc, offer, jdata.Deposit); err != nil {
		return err
	}

	return w.clientPreChannelTopUpSaveTx(logger, job, ch, acc, offer,
		jdata.GasPrice, uint64(jdata.Deposit))
}
func (w *Worker) ClientPreChannelTopUp(job *data.Job) error {
	logger := w.logger.Add("method", "ClientPreChannelTopUp", "job", job)

	ch, err := w.relatedChannel(logger, job, data.JobClientPreChannelTopUp)
	if err != nil {
		return err
	}

	offer, err := w.offering(logger, ch.Offering)
	if err != nil {
		return err
	}

	acc, err := w.account(logger, ch.Client)
	if err != nil {
		return err
	}

	logger = logger.Add("channel", ch, "offering", offer)

	var jdata data.JobTopUpChannelData
	if err := w.unmarshalDataTo(logger, job.Data, &jdata); err != nil {
		return err
	}

	if err := w.checkDeposit(logger, acc, offer, jdata.Deposit); err != nil {
		return err
	}

	return w.clientPreChannelTopUpSaveTx(logger, job, ch, acc, offer,
		jdata.GasPrice, uint64(jdata.Deposit))
}
func ( w * Worker ) ClientPreChannelTopUp ( job * data . Job ) error { logger := w . logger . Add ( " " , " " , " " , job ) ch , err := w . relatedChannel ( logger , job , data . JobClientPreChannelTopUp ) if err != nil { return err } offer , err := w . offering ( logger , ch . Offering ) if err != nil { return err } acc , err := w . account ( logger , ch . Client ) if err != nil { return err } logger = logger . Add ( " " , ch , " " , offer ) var jdata data . JobTopUpChannelData if err := w . unmarshalDataTo ( logger , job . Data , & jdata ) ; err != nil { return err } if err := w . checkDeposit ( logger , acc , offer , jdata . Deposit ) ; err != nil { return err } return w . clientPreChannelTopUpSaveTx ( logger , job , ch , acc , offer , jdata . GasPrice , uint64 ( jdata . Deposit ) ) }
// ClientPreChannelTopUp checks client balance and creates transaction
// for increase the channel deposit.
ClientPreChannelTopUp checks client balance and creates transaction for increase the channel deposit .