func (w *Worker) AgentAfterCooperativeClose(job *data.Job) error {
	logger := w.logger.Add("method", "AgentAfterCooperativeClose",
		"job", job)
	channel, err := w.relatedChannel(logger,
		job, data.JobAgentAfterCooperativeClose)
	if err != nil {
		return err
	}

	return w.db.InTransaction(func(tx *reform.TX) error {
		channel.ChannelStatus = data.ChannelClosedCoop
		if err := tx.Update(channel); err != nil {
			logger.Error(err.Error())
			return ErrInternal
		}

		if err := w.incrementCurrentSupply(logger, tx.Querier,
			channel.Offering); err != nil {
			return err
		}

		agent, err := w.account(logger, channel.Agent)
		if err != nil {
			return err
		}

		return w.addJob(logger, tx,
			data.JobAccountUpdateBalances, data.JobAccount, agent.ID)
	})
}
func (w *Worker) AgentAfterCooperativeClose(job *data.Job) error {
	logger := w.logger.Add("method", "AgentAfterCooperativeClose",
		"job", job)
	channel, err := w.relatedChannel(logger,
		job, data.JobAgentAfterCooperativeClose)
	if err != nil {
		return err
	}

	return w.db.InTransaction(func(tx *reform.TX) error {
		channel.ChannelStatus = data.ChannelClosedCoop
		if err := tx.Update(channel); err != nil {
			logger.Error(err.Error())
			return ErrInternal
		}

		if err := w.incrementCurrentSupply(logger, tx.Querier,
			channel.Offering); err != nil {
			return err
		}

		agent, err := w.account(logger, channel.Agent)
		if err != nil {
			return err
		}

		return w.addJob(logger, tx,
			data.JobAccountUpdateBalances, data.JobAccount, agent.ID)
	})
}
func ( w * Worker ) AgentAfterCooperativeClose ( job * data . Job ) error { logger := w . logger . Add ( " " , " " , " " , job ) channel , err := w . relatedChannel ( logger , job , data . JobAgentAfterCooperativeClose ) if err != nil { return err } return w . db . InTransaction ( func ( tx * reform . TX ) error { channel . ChannelStatus = data . ChannelClosedCoop if err := tx . Update ( channel ) ; err != nil { logger . Error ( err . Error ( ) ) return ErrInternal } if err := w . incrementCurrentSupply ( logger , tx . Querier , channel . Offering ) ; err != nil { return err } agent , err := w . account ( logger , channel . Agent ) if err != nil { return err } return w . addJob ( logger , tx , data . JobAccountUpdateBalances , data . JobAccount , agent . ID ) } ) }
// AgentAfterCooperativeClose marks channel as closed coop.
AgentAfterCooperativeClose marks channel as closed coop .