func processTicket(routingInfo resolver.RoutingInfo, addrInfo resolver.AddressInfo, header *message.Header, msgID string) (*ticket.Ticket, error) {
	// Get upload ticket
	h, err := hash.NewFromHash(addrInfo.Hash)
	if err != nil {
		return nil, err
	}

	logrus.Tracef("getting ticket for %s:%s:%s", header.From.Addr, *h, "")

	c, err := getClient(routingInfo)
	if err != nil {
		return nil, err
	}

	t, err := c.GetTicket(header.From.Addr, *h, "")
	if err != nil {
		return nil, err
	}

	// If the ticket is valid, then we are done
	if t.Valid {
		return t, nil
	}

	logrus.Debugf("ticket %s not valid. Need to do proof of work", t.ID)

	// Do proof of work. We have to wait for it. This is ok as this is just a separate thread.
	t.Work.Data.Work()

	logrus.Debugf("work for %s is completed", t.ID)
	t, err = c.ValidateTicket(header.From.Addr, header.To.Addr, t.SubscriptionID, t)
	if err != nil || !t.Valid {
		logrus.Warnf("Ticket for message %s not valid after proof of work, moving to retry queue", msgID)
		MoveToRetryQueue(msgID)
		return nil, errValidating
	}

	// TIcket is ok after we done our proof-of-work
	return t, nil
}
// processTicket will fetch a ticket from the mail server and validate it through proof-of-work
processTicket will fetch a ticket from the mail server and validate it through proof-of-work
// processTicket will fetch a ticket from the mail server and validate it through proof - of - work
func processTicket(routingInfo resolver.RoutingInfo, addrInfo resolver.AddressInfo, header *message.Header, msgID string) (*ticket.Ticket, error) {
	h, err := hash.NewFromHash(addrInfo.Hash)
	if err != nil {
		return nil, err
	}
	logrus.Tracef("getting ticket for %s:%s:%s", header.From.Addr, *h, "")
	c, err := getClient(routingInfo)
	if err != nil {
		return nil, err
	}
	t, err := c.GetTicket(header.From.Addr, *h, "")
	if err != nil {
		return nil, err
	}
	if t.Valid {
		return t, nil
	}
	logrus.Debugf("ticket %s not valid. Need to do proof of work", t.ID)
	t.Work.Data.Work()
	logrus.Debugf("work for %s is completed", t.ID)
	t, err = c.ValidateTicket(header.From.Addr, header.To.Addr, t.SubscriptionID, t)
	if err != nil || !t.Valid {
		logrus.Warnf("Ticket for message %s not valid after proof of work, moving to retry queue", msgID)
		MoveToRetryQueue(msgID)
		return nil, errValidating
	}
	return t, nil
}
func processTicket ( routingInfo resolver . RoutingInfo , addrInfo resolver . AddressInfo , header * message . Header , msgID string ) ( * ticket . Ticket , error ) { h , err := hash . NewFromHash ( addrInfo . Hash ) if err != nil { return nil , err } logrus . Tracef ( " " , header . From . Addr , * h , " " ) c , err := getClient ( routingInfo ) if err != nil { return nil , err } t , err := c . GetTicket ( header . From . Addr , * h , " " ) if err != nil { return nil , err } if t . Valid { return t , nil } logrus . Debugf ( " " , t . ID ) t . Work . Data . Work ( ) logrus . Debugf ( " " , t . ID ) t , err = c . ValidateTicket ( header . From . Addr , header . To . Addr , t . SubscriptionID , t ) if err != nil || ! t . Valid { logrus . Warnf ( " " , msgID ) MoveToRetryQueue ( msgID ) return nil , errValidating } return t , nil }
processTicket will fetch a ticket from the mail server and validate it through proof-of-work
processTicket will fetch a ticket from the mail server and validate it through proof - of - work
// Get upload ticket // If the ticket is valid, then we are done // Do proof of work. We have to wait for it. This is ok as this is just a separate thread. // TIcket is ok after we done our proof-of-work