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

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

	ethLog, err := w.ethLog(logger, job)
	if err != nil {
		return err
	}

	logger = logger.Add("channel", ch, "ethLog", ethLog)

	ch.Block = uint32(ethLog.Block)
	ch.ChannelStatus = data.ChannelActive
	if err = w.saveRecord(logger, w.db.Querier, ch); err != nil {
		return err
	}

	key, err := w.keyFromChannelData(logger, ch.ID)
	if err != nil {
		return err
	}

	logger = logger.Add("endpointKey", key)

	var endpointMsgSealed []byte

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

	if err == nil {
		client, err := w.somcClientBuilder.NewClient(offering.SOMCType, offering.SOMCData)
		if err != nil {
			logger.Error(err.Error())
			return ErrGetEndpoint
		}
		rawMsg, err := client.Endpoint(key)
		if err != nil {
			logger.Error(err.Error())
			return ErrGetEndpoint
		}
		endpointMsgSealed, err = data.ToBytes(rawMsg)
		if err != nil {
			logger.Error(err.Error())
			return ErrGetEndpoint
		}
	}

	err = w.addJobWithData(logger, nil, data.JobClientEndpointRestore,
		data.JobChannel, ch.ID, &data.JobEndpointCreateData{EndpointSealed: endpointMsgSealed})
	if err != nil {
		return err
	}

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

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

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

	ethLog, err := w.ethLog(logger, job)
	if err != nil {
		return err
	}

	logger = logger.Add("channel", ch, "ethLog", ethLog)

	ch.Block = uint32(ethLog.Block)
	ch.ChannelStatus = data.ChannelActive
	if err = w.saveRecord(logger, w.db.Querier, ch); err != nil {
		return err
	}

	key, err := w.keyFromChannelData(logger, ch.ID)
	if err != nil {
		return err
	}

	logger = logger.Add("endpointKey", key)

	var endpointMsgSealed []byte

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

	if err == nil {
		client, err := w.somcClientBuilder.NewClient(offering.SOMCType, offering.SOMCData)
		if err != nil {
			logger.Error(err.Error())
			return ErrGetEndpoint
		}
		rawMsg, err := client.Endpoint(key)
		if err != nil {
			logger.Error(err.Error())
			return ErrGetEndpoint
		}
		endpointMsgSealed, err = data.ToBytes(rawMsg)
		if err != nil {
			logger.Error(err.Error())
			return ErrGetEndpoint
		}
	}

	err = w.addJobWithData(logger, nil, data.JobClientEndpointRestore,
		data.JobChannel, ch.ID, &data.JobEndpointCreateData{EndpointSealed: endpointMsgSealed})
	if err != nil {
		return err
	}

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

	return w.addJob(logger, nil,
		data.JobAccountUpdateBalances, data.JobAccount, client.ID)
}
func ( w * Worker ) ClientAfterChannelCreate ( job * data . Job ) error { logger := w . logger . Add ( " " , " " , " " , job ) ch , err := w . relatedChannel ( logger , job , data . JobClientAfterChannelCreate ) if err != nil { return err } ethLog , err := w . ethLog ( logger , job ) if err != nil { return err } logger = logger . Add ( " " , ch , " " , ethLog ) ch . Block = uint32 ( ethLog . Block ) ch . ChannelStatus = data . ChannelActive if err = w . saveRecord ( logger , w . db . Querier , ch ) ; err != nil { return err } key , err := w . keyFromChannelData ( logger , ch . ID ) if err != nil { return err } logger = logger . Add ( " " , key ) var endpointMsgSealed [ ] byte offering , err := w . offering ( logger , ch . Offering ) if err != nil { return err } if err == nil { client , err := w . somcClientBuilder . NewClient ( offering . SOMCType , offering . SOMCData ) if err != nil { logger . Error ( err . Error ( ) ) return ErrGetEndpoint } rawMsg , err := client . Endpoint ( key ) if err != nil { logger . Error ( err . Error ( ) ) return ErrGetEndpoint } endpointMsgSealed , err = data . ToBytes ( rawMsg ) if err != nil { logger . Error ( err . Error ( ) ) return ErrGetEndpoint } } err = w . addJobWithData ( logger , nil , data . JobClientEndpointRestore , data . JobChannel , ch . ID , & data . JobEndpointCreateData { EndpointSealed : endpointMsgSealed } ) if err != nil { return err } client , err := w . account ( logger , ch . Client ) if err != nil { return err } return w . addJob ( logger , nil , data . JobAccountUpdateBalances , data . JobAccount , client . ID ) }
// ClientAfterChannelCreate activates channel and triggers endpoint retrieval.
ClientAfterChannelCreate activates channel and triggers endpoint retrieval .