func (w *Worker) AgentAfterUncooperativeClose(job *data.Job) error {
	logger := w.logger.Add("method", "AgentAfterUncooperativeClose",
		"job", job)

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

	if channel.ServiceStatus != data.ServiceTerminated {
		_, err = w.processor.TerminateChannel(
			channel.ID, data.JobTask, true)
		if err != nil {
			logger.Error(err.Error())
			return ErrTerminateChannel
		}
	}

	channel.ChannelStatus = data.ChannelClosedUncoop
	if err = w.db.Update(channel); err != nil {
		logger.Error(err.Error())
		return ErrInternal
	}

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

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

	return w.addJob(logger, nil,
		data.JobAccountUpdateBalances, data.JobAccount, agent.ID)
}
func (w *Worker) AgentAfterUncooperativeClose(job *data.Job) error {
	logger := w.logger.Add("method", "AgentAfterUncooperativeClose",
		"job", job)

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

	if channel.ServiceStatus != data.ServiceTerminated {
		_, err = w.processor.TerminateChannel(
			channel.ID, data.JobTask, true)
		if err != nil {
			logger.Error(err.Error())
			return ErrTerminateChannel
		}
	}

	channel.ChannelStatus = data.ChannelClosedUncoop
	if err = w.db.Update(channel); err != nil {
		logger.Error(err.Error())
		return ErrInternal
	}

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

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

	return w.addJob(logger, nil,
		data.JobAccountUpdateBalances, data.JobAccount, agent.ID)
}
func ( w * Worker ) AgentAfterUncooperativeClose ( job * data . Job ) error { logger := w . logger . Add ( " " , " " , " " , job ) channel , err := w . relatedChannel ( logger , job , data . JobAgentAfterUncooperativeClose ) if err != nil { return err } if channel . ServiceStatus != data . ServiceTerminated { _ , err = w . processor . TerminateChannel ( channel . ID , data . JobTask , true ) if err != nil { logger . Error ( err . Error ( ) ) return ErrTerminateChannel } } channel . ChannelStatus = data . ChannelClosedUncoop if err = w . db . Update ( channel ) ; err != nil { logger . Error ( err . Error ( ) ) return ErrInternal } if err := w . incrementCurrentSupply ( logger , w . db . Querier , channel . Offering ) ; err != nil { return err } agent , err := w . account ( logger , channel . Agent ) if err != nil { return err } return w . addJob ( logger , nil , data . JobAccountUpdateBalances , data . JobAccount , agent . ID ) }
// AgentAfterUncooperativeClose marks channel closed uncoop.
AgentAfterUncooperativeClose marks channel closed uncoop .