def submit_job(self, data, t):
        """ Handles recieving work submission and checking that it is valid
        , if it meets network diff, etc. Sends reply to stratum client. """
        params = data['params']
        # [worker_name, job_id, extranonce2, ntime, nonce]
        # ["slush.miner1", "bf", "00000001", "504e86ed", "b2957c02"]
        if __debug__:
            self.logger.debug(
                "Recieved work submit:\n\tworker_name: {0}\n\t"
                "job_id: {1}\n\textranonce2: {2}\n\t"
                "ntime: {3}\n\tnonce: {4} ({int_nonce})"
                .format(
                    *params,
                    int_nonce=struct.unpack(str("<L"), unhexlify(params[4]))))

        if self.idle:
            self.idle = False
            self.server.idle_clients -= 1

        self.last_share_submit = time.time()

        try:
            difficulty, job = self.job_mapper[data['params'][1]]
            job = job()  # weakref will be None if the job has been GCed
        except KeyError:
            try:
                difficulty, job = self.old_job_mapper[data['params'][1]]
                job = job()  # weakref will be None if the job has been GCed
            except __HOLE__:
                job = None  # Job not in jobmapper at all, we got a bogus submit
                # since we can't identify the diff we just have to assume it's
                # current diff
                difficulty = self.difficulty

        if job not in self.server.active_jobs:
            self.send_error(self.STALE_SHARE_ERR, id_val=data['id'])
            self.reporter.log_share(client=self,
                                    diff=self.difficulty,
                                    typ=self.STALE_SHARE,
                                    params=params,
                                    job=job,
                                    start=t)
            return difficulty, self.STALE_SHARE

        # assemble a complete block header bytestring
        header = job.block_header(
            nonce=params[4],
            extra1=self._id,
            extra2=params[2],
            ntime=params[3])

        # Check a submitted share against previous shares to eliminate
        # duplicates
        share_lower = (self._id.lower(), params[2].lower(), params[4].lower(), params[3].lower())

        if share_lower in job.acc_shares:
            self.logger.info("Duplicate share rejected from worker {}.{}!"
                             .format(self.address, self.worker))
            self.send_error(self.DUP_SHARE_ERR, id_val=data['id'])
            self.reporter.log_share(client=self,
                                    diff=difficulty,
                                    typ=self.DUP_SHARE,
                                    params=params,
                                    job=job,
                                    start=t)
            return difficulty, self.DUP_SHARE

        job_target = target_from_diff(difficulty, job.diff1)
        hash_int = uint256_from_str(self.algo['module'](header))
        if hash_int >= job_target:
            self.logger.info("Low diff share rejected from worker {}.{}!"
                             .format(self.address, self.worker))
            self.send_error(self.LOW_DIFF_ERR, id_val=data['id'])
            self.reporter.log_share(client=self,
                                    diff=difficulty,
                                    typ=self.LOW_DIFF_SHARE,
                                    params=params,
                                    job=job,
                                    start=t)
            return difficulty, self.LOW_DIFF_SHARE

        # we want to send an ack ASAP, so do it here
        self.send_success(id_val=data['id'])
        # Add the share to the accepted set to check for dups
        job.acc_shares.add(share_lower)
        self.accepted_shares += difficulty
        self.reporter.log_share(client=self,
                                diff=difficulty,
                                typ=self.VALID_SHARE,
                                params=params,
                                job=job,
                                header_hash=hash_int,
                                header=header,
                                start=t)

        return difficulty, self.VALID_SHARE
dataset/ETHPy150Open simplecrypto/powerpool/powerpool/stratum_server.py/StratumClient.submit_job